user-defined types and basic_string

Benjamin Kosnik bkoz@redhat.com
Fri Aug 23 11:20:00 GMT 2002


> You'd need to get rid of the character ctors to make it conforming and
> portable (the type must be a POD), but other than that it looks pretty
> close to our charT that we test string and iostreams with (see below) :)

thanks

> You must have a lot of time on your hands ;-) Are you really willing
> to rewrite all facets as an exercise? I think the only feasible approach
> would be to either add a traits template parameter to them or diligently
> use char_traits<char_type> in all facets and hope that the user
> specializes it rather than creating their own (unrelated) class.

The second. As noted previously, unless there is an assumption about the
use of char_traits<> specializations, then there is ambiguity in things
like num_get, where you have _CharT, and _IterT, but no explicit
_Traits.

Since I'm the user in this case, I'm planning on donig the sane thing...

;)

-benjamin



More information about the Libstdc++ mailing list