我希望写出以下代码:
:
template<typename T> const int a;
template<> const int a<float>=5;
template<> const int a<double>=14;
template<> const int a<char>=6;
template<> const int a<wchar>=33;
template<> const bool a<bool> = 17;
是行不通的,而template<> const int a<bool> = 17;
应该可以。 - Ben Voigttypeid
。 - Shoe