Boost logo

Boost :

From: Adam Badura (abadura_at_[hidden])
Date: 2005-09-16 11:00:40


> Also, there is nothing stopping you doing:
>
> window.SetText( std::string( "Hello World" ).c_str());
>
> and:
>
> ATL::CString text;
> window.GetText( text );
> return std::string( static_cast< const char * >( text ));
>
> If you want to use TCHAR's:
>
> typedef std::basic_string< TCHAR > _tstring;
>
> so you could have:
>
> namespace boost { namespace gui
> {
> #if defined(BOOST_WINDOWS) || defined(BOOST_HAS_TCHAR)
> typedef std::basic_string< TCHAR > string;
> #else
> typedef std::string string;
> #endif
> }}
>
> Then you can use gui::string in a generic, cross-platform way. Granted, it
> is (slightly) more work, but there is no need to use the string types
> provided by a particular GUI framework.

    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.

    Adam Badura


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