Why does template parameter deduction for T 'skips' the constness of array elements when function parameter is const reference to T?
问题 Let's consider those definitions: /*** full type information with typeid ***/ template <class> class Type{}; template <class T> std::string typeStr() { return typeid(Type<T>).name(); } /*** function template for parameter deduction ***/ template <class T> void func(const T &a) { std::cout << "Deduced type for T is: " << typeStr<T>() << std::endl; std::cout << "\targument type is: " << typeStr<decltype(a)>() << std::endl; } with pointers to const If the following statements are executed: const