This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: user-defined types and basic_string


>    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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]