Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2006-04-11 06:42:10


Reece Dunn wrote:
> 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 & )

You don't need these two if you have the third.

> 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 > & )

There is no reason to make users' lives more difficult just for the fun of
it, and the standard library doesn't do it. There aren't three separate
getline/wgetline/basic_getline functions, for example.


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