[dcl.type.class.deduct] (original) (raw)
9 Declarations [dcl]
9.2 Specifiers [dcl.spec]
9.2.9 Type specifiers [dcl.type]
9.2.9.8 Deduced class template specialization types [dcl.type.class.deduct]
If a placeholder for a deduced class type appears as a decl-specifierin the decl-specifier-seqof an initializing declaration ([dcl.init]) of a variable, the declared type of the variable shall be cv T, where T is the placeholder.
[Example 1: template <class ...T> struct A { A(T...) {} }; A x[29]{}; const A& y{}; — _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]).
A placeholder for a deduced class type shall not appear in any other context.
[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); auto d = container(v.begin(), v.end()); container e{5, 6}; — _end example_]