c++ - std::basic_string specialization -
i need override length function std::basic_string because it's not correct custom char type on specific platform. current declaration for, let's say, customstring
typedef stl::basic_string<customchar, stl::char_traits<customchar>, stl::allocator<customchar> > customstring;
i need have class behaves customstring, length function changed.
you need specialise std::char_traits
structure , override static size_t length(const char_type* s);
function that.
then don’t need specify template parameters when instantiating basic_string
. following definition should enough:
typedef std::basic_string<customchar> customstring;
Comments
Post a Comment