2017-12-03 272 views

cevap

6

Clang hata [dcl.type.class.deduct] itibaren (#34091)

:

bir çıkarılmış sınıf türü için bir yer tutucu da kullanılabilir [...] veya basit tip-belirticiniz olarak Bir explicit type conversion (functional notation). Çıkarılan sınıf türü için bir yer tutucu başka bir bağlamda görünmez. [Örnek:

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 

- uç örneği]