Re: [boost] Report from Berlin C++ Standards Committee meeting

Maxim Yegorushkin wrote:
On 4/11/06, Reece Dunn <msclrhd@hotmail.com> 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/

Reece Dunn wrote:
Maxim Yegorushkin wrote:
On 4/11/06, Reece Dunn <msclrhd@hotmail.com> 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.

"Reece Dunn" <msclrhd@hotmail.com> writes:
Maxim Yegorushkin wrote:
On 4/11/06, Reece Dunn <msclrhd@hotmail.com> 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 > & )
I'm not sure consistency is a virtue in this case. -- Dave Abrahams Boost Consulting www.boost-consulting.com
participants (3)
-
David Abrahams
-
Peter Dimov
-
Reece Dunn