user-defined types and basic_string
Benjamin Kosnik
bkoz@redhat.com
Thu Aug 29 09:59:00 GMT 2002
> inline character<unsigned short>
> as_character(unsigned short c)
> {
> character<unsigned short> r = { c };
> return c;
> }
>
> With inlining and the named return value optimization, that should
> cost nothing.
>
> | basic_string<char_type> theString;
> | theString.append(0x20);
>
> theString.append(as_character(0x20));
>
> | theString.append('o');
>
>
> theString.append(as_character('o'));
Ok! This isn't bad.
Gaby I've got to run, movers are here and I'll be in transit to Chicago
in a few hours, but if you could re-post the example file with this it
would prove helpful.
Anthony, if you post an example of what you are doing it would be helpful.
At some point this thread should be documented and added to the 21_strings FAQ.
-benjamin
More information about the Libstdc++
mailing list