Boost logo

Boost :

From: Reece Dunn (msclrhd_at_[hidden])
Date: 2005-09-16 11:32:58


Adam Badura wrote:
> > Also, there is nothing stopping you doing:
> >
> > window.SetText( std::string( "Hello World" ).c_str());
>
> Naturally. Usability of library which cannot use "string" objects
>would
>be a best bad.
> But that makes code longer and harder to understand. STD is made to be
>used. What for do we have all those classes if every library makes its own
>(without deriving them from stnadard classes).
> It is not a case of life or death but i think it is a good habit (to
>use
>standard classes) and makes a library (generaly) better.

You would use the above to interact with (GUI) libraries that do not have
std::xstring support, just like you would with the C-style functions,
ifstream and others. Granted, this situation is not ideal and there are
proposals to add std::xstring variants for the C/C++ standard library
functions.

With a standard GUI library proposal, you would use std::[w]string
(depending on the character support for the platform). That is a no brainer.
What I was referring to is how you would interact with legacy GUI libraries
that don't have inbuilt std::[w]string support, for example:

   namespace gui { namespace detail { namespace wtl
   {
      struct window
      {
         void set_text( const gui::string & text )
         {
            SetText( text.c_str());
         };
      };
   }}}

- Reece


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk