If a placeholder for a deduced class type
appears as a decl-specifier
in the decl-specifier-seq
of an initializing declaration ([dcl.init]) of a variable,
the declared type of the variable shall be cvT,
where T is the placeholder.
[Example 1: template<class...T>struct A {
A(T...){}};
A x[29]{}; // error: no declarator operators allowedconst A& y{}; // error: no declarator operators allowed — end example]
The placeholder is replaced by the return type
of the function selected by overload resolution
for class template deduction ([over.match.class.deduct]).
[Example 2: template<class T>struct container {
container(T t){}template<class Iter> container(Iter beg, Iter end);
};
template<class Iter>
container(Iter b, Iter e)-> container<typename std::iterator_traits<Iter>::value_type>;
std::vector<double> v ={/* ... */};
container c(7); // OK, deduces int for Tauto d = container(v.begin(), v.end()); // OK, deduces double for T
container e{5, 6}; // error: int is not an iterator — end example]