-
3 votesanswersviews
类模板中静态变量模板的部分规范
如果我做部分专业化,我会从clang和g得到不同的结果 . template < typename T> class X { public: T i; X(T _i): i{_i}{} operator T(){ return i; } }; template < typename T2 > class Y {... -
12 votesanswersviews
是否需要初始化参考变量主模板,即使它从未实例化?
在没有初始化主要参考模板的情况下在C 14中声明参考模板是否合法,只要它从未实例化过? template<class T> const T& ref; template<> auto ref<int> = 1; auto x = ref<int>; 这会在GCC和Clang上产生不同的结果: $ g++ -std=c++14 -c re...