$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [boost] Formal Review Request: Boost.String.Convert
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2009-02-18 18:10:48
Emil Dotchevski wrote:
>>>>> You can define template operator<<
>>>> How is that?
>>> What do you mean how? You just define a template operator<< and the
>>> library-supplied to_string/to_wstring templates will bind to it,
>>> assuming the user's calls to_string or to_wstring doesn't bind to a
>>> better overload of to_string/to_wstring.
>> Which of the to_string/to_wstring functions should I call from the
>> operator<< template?
>
> If all you want is to implement operator<< template in terms of
> to_string/to_wstring, you won't have to do that because the library
> will do it for you. That is, if I give you a foo overload of to_string
> only, but you want to use operator<< for foo, all you'd have to do is
> include the appropriate header from the library and foo.hpp, and then
> you can call operator<< as needed, which in this case will forward
> your call to to_string.
I'm confused. So, the users will have to specify to_string overloads
instead of streaming operators?
>> It looks like you suggest that the library should implement wide streaming
>> capability for all classes that it can reach (i.e. those have the narrow
>> operator<<). Somehow, I don't quite like that kind of a "helping hand". I
>> suspect it may introduce problems with efficiency, as it will have to
>> unnecessarily transcode strings.
>
> If this inefficiency is a problem, it can be easily addressed by
> introducing the appropriate optimal overloads. If not, you're arguing
> premature optimization.
That's right, overloads for all character types, which is the
duplication I'm against.