c++.stl.port - Adding/customizing new std::char_traits
- Scott Michel (23/23) Apr 08 2004 I've got a bit of a problem adding an additional std::char_traits to
I've got a bit of a problem adding an additional std::char_traits to STLport. I happen to need an unsigned char-based char_traits, i.e., std::char_traits<unsigned char>. I'm using the unsigned char_traits to read/write network streams -- it's a funky iostream class I've written that deals with fixed length frames as well as length fixups (when the length of an element is unknown and precedes the actual data but you want to write directly into the buffer and fix up the length field later.) I've found that the std::char_traits<char> is derived from another base class, _char_traits_base<char, int>. This is a little odd and not as clean as gcc's libstdc++, but it's not too bad. I can work around this with conditional compilation. Apparently, to make std::char_traits<> work, I also need std::ctype<unsigned char> and std::numpunct<unsigned char>, which are locale facets. The problem I'm facing is how properly add or register these facets with the global "C" locale. Anyone have a clue to pass on? The STLport lists aren't particularly helpful. -scooter -- Scott Michel | No research proposal ever survives UCLA Computer Science | contact with implementation. PhD Graduate Student | !! Futuaris nisi irrisus ridebis !!
Apr 08 2004