
Gennadiy Rozental wrote:
There's nothing wrong with that. It is std::basic_string's interface that provides for the use of a policy class. That std::char_traits happens to be the most appropriate -- it rarely isn't -- implementation of that policy is beside the point. You can argue that std::basic_string shouldn't have such a policy parameter, and you'd probably be right, but that's not std::char_traits' fault.
That's right. It's basic_string fault, which should've used char_traits by name in basic_string implementation.
I don't want to turn this into a std::string discussion, but if basic_string used char_traits by name, how would you define two different string types using char*, one with case-sensitive comparison and one without? With basic_string the way it is, it's possible; the way you're proposing, I don't see how to do it. There are lots of problems with basic_string, but template<typename T, typename traits = xxx<T> > class foo; isn't one of them. Bob