7 Declarations [dcl.dcl]

7.1 Specifiers [dcl.spec]

7.1.7 Type specifiers [dcl.type]

7.1.7.5 Deduced class template specialization types [dcl.type.class.deduct]

If a placeholder for a deduced class type appears as a decl-specifier in the decl-specifier-seq of a simple-declaration, the init-declarator of that declaration shall be of the form

declarator-id attribute-specifier-seqopt initializer

The placeholder is replaced by the return type of the function selected by overload resolution for class template deduction ([over.match.class.deduct]). If the init-declarator-list contains more than one init-declarator, the type that replaces the placeholder shall be the same in each deduction. [ Example:

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 T
auto d = container(v.begin(), v.end()); // OK, deduces double for T
container e{5, 6};                      // error, int is not an iterator

 — end example ]