10 Declarations [dcl.dcl]

10.1 Specifiers [dcl.spec]

10.1.7 Type specifiers [dcl.type]

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

Если заполнитель для выведенного типа класса отображается как a decl-specifier в decl-specifier-seq объявлении инициализации ([dcl.init]) переменной, заполнитель заменяется типом возвращаемого значения функции, выбранной разрешением перегрузки для вывода шаблона класса ([over.match.class.deduct]). Если за decl-specifier-seq символом следует init-declarator-list или, member-declarator-list содержащий более одного declarator, тип, который заменяет заполнитель, должен быть одинаковым при каждом вычитании.

Заполнитель для выведенного типа класса также может использоваться type-specifier-seq в new-type-idили type-id в new-expression, или как simple-type-specifier в явном преобразовании типа (функциональная нотация) ([expr.type.conv]). Заполнитель для выведенного типа класса не должен появляться ни в каком другом контексте.

[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]