相关问题:
请考虑以下代码:
template <typename T>
struct is_std_vector: std::false_type { };
template<typename ValueType>
struct is_std_vector<std::vector<ValueType>>: std::true_type { };
Run Code Online (Sandbox Code Playgroud)
为什么这样的模板类专业化语法是正确的?以下似乎更合乎逻辑:
template <typename T>
struct is_std_vector: std::false_type { };
template<> //--- because it is is_std_vector specialization
template<typename ValueType>
struct is_std_vector<std::vector<ValueType>>: std::true_type { };
Run Code Online (Sandbox Code Playgroud)