在http://en.cppreference.com/w/cpp/string/basic_string找到的std :: basic_string文档中,basic_string类声明如下。了解如何声明模板参数的默认值
template<
class CharT,
class Traits = std::char_traits<CharT>,
class Allocator = std::allocator<CharT>
> class basic_string;
但是,在GCC和Visual Studio中,Traits和Allocator模板参数的缺省值都未在类声明中指定。
以下是来自GCC 4.9.2的basic_string.h。
template<
typename _CharT,
typename _Traits,
typename _Alloc
> class basic_string
请注意缺少_Traits和_Alloc模板参数的默认值。
我错过了什么?
头本身可以在https://gcc.gnu.org/onlinedocs/gcc-4.6.3/libstdc++/api/a01077_source.html找到。 –