的类型特征我试图定义一个类型特征,我可以使用static_assert
来控制我的一个模板类仅通过s td::array<T,n>
实例化。这里是我的尝试:std :: array
template <typename T>
struct is_std_array : public false_type {};
template <template <typename, size_t> class T, typename V, size_t n>
struct is_std_array<std::array<V, n>> : public true_type {};
但我从铛收到以下警告:
warning: class template partial specialization contains a template parameter
that cannot be deduced; this partial specialization will never be used
non-deductible template parameter 'T'
为什么是 'T' 不计免赔?我如何解决这个问题?
你能帮我使用true_type和false_type这样吗? –