Boost logo

Boost :

From: Reece Dunn (msclrhd_at_[hidden])
Date: 2006-04-11 05:49:42


Maxim Yegorushkin wrote:
> On 4/11/06, Reece Dunn <msclrhd_at_[hidden]> wrote:
>
> []
>
> > The string_to<T> function could have basic_string and wstring overloads, but this would be inconsistent with the rest of the C++ library.
>
> I don't like the idea of the user having to convert whichever string
> he happens to use to std::basic_string just to do the conversion.

The overloaded version would look something like:

   T string_to<T>( const std::string & )
   T string_to<T>( const std::wstring & )
   T string_to<T>( const std::basic_string< CharT, CharTraits, Allocator > & )

whereas, to be more consistent with the rest of the standard library, you would have something like:

   T string_to<T>( const std::string & )
   T wstring_to<T>( const std::wstring & )
   T basic_string_to<T>( const std::basic_string< CharT, CharTraits, Allocator > & )

If the string is not a std::basic_string, then you can have a C-style string overload to not have the conversion:

   T string_to<T>( const char * )
   T wstring_to<T>( const wchar_t * )

this shouldn't be a problem.

- Reece
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


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