[temp.type] (original) (raw)
13 Templates [temp]
13.6 Type equivalence [temp.type]
Two values are template-argument-equivalent if they are of the same type and
- they are of integral type and their values are the same, or
- they are of floating-point type and their values are identical, or
- they are of type std::nullptr_t, or
- they are of type std::meta::info and their values compare equal ([expr.eq]), or
- they are of enumeration type and their values are the same,112or
- they are of pointer type and they have the same pointer value, or
- they are of pointer-to-member type and they refer to the same class member or are both the null member pointer value, or
- they are of reference type and they refer to the same object or function, or
- they are of array type and their corresponding elements are template-argument-equivalent,113or
- they are of union type and either they both have no active member or they have the same active member and their active members are template-argument-equivalent, or
- they are of a closure type ([expr.prim.lambda.closure]), or
- they are of class type and their corresponding direct subobjects and reference members are template-argument-equivalent.
[Example 1:
template<class E, int size> class buffer { }; buffer<char,2*512> x; buffer<char,1024> y;declaresxandyto be of the same type, andtemplate<class T, void(*err_fct)()> class list { }; list<int,&error_handler1> x1; list<int,&error_handler2> x2; list<int,&error_handler2> x3; list<char,&error_handler2> x4;declaresx2andx3to be of the same type.
Their type differs from the types ofx1andx4.
template<class T> struct X { };template<class> struct Y { };template<class T> using Z = Y<T>; X<Y<int> > y; X<Z<int> > z;declares y and z to be of the same type.
— _end example_]
If an expression e is type-dependent,decltype(e)denotes a unique dependent type.
[Note 1:
However, such a type might be aliased, e.g., by a typedef-name.
— _end note_]
Otherwise, two such pack-index-specifiers refer to the same type only if their indexes have the same value.