There is a bug in libstdc++, libc++, and MSVC's STL that causes it to ignore unused template parameter arguments in template aliases and does not cause substitution failures. This defect has been recorded here: http://open‐std.org/JTC1/SC22/WG21/docs/cwg_defects.html#1558.

Description

This causes the implementation of std::void_t to be buggy, as it is likely defined as something like the following:

template <typename...> using void_t = void;

This causes the compiler to ignore all the template arguments and does not help when one wants to cause substitution failures. Rather declarations which have void_t in orthogonal specializations are treated as the same. For example, assuming the possible T types are only allowed to have either the alias one or two and never both or none:

template <typename T, typename std::void_t<std::decay_t<T>::one>* = nullptr> void foo(T&&) {} template <typename T, typename std::void_t<std::decay_t<T>::two>* = nullptr> void foo(T&&) {}

The second foo() will be a redefinition because it conflicts with the first one; void_t does not cause substitution failures ‐ the template types are just ignored.

Types

Name

Description

type_pack_element_indexed_type

A helper pairing an index with the type at that position.

type_pack_element_set

A helper collecting a type pack as a set of indexed types.

type_pack_element_test

A helper that recovers the type stored at a given index.

type_t_

A helper that exposes its first type argument, ignoring the rest.

uint_bits_t_

A helper mapping a bit width to the unsigned integer type of that width.

value_list_traits_

A helper exposing the size and elements of a value list.

value_pack_constant

A helper wrapping a single value as a type carrying that value.

Type Aliases

Name

Description

type_pack_element_fallback

A fallback implementation of type_pack_element_t without the builtin.

type_pack_element_set_t

An alias building the indexed‐type set for the pack T.

Functions

Name

Description

type_list_element_

Deduces the type identity of the Ith element of a type list.

type_list_size_

Deduces the size of a type list.

Created with MrDocs