Boost logo

Boost :

Subject: Re: [boost] Variadic append for std::string
From: Christof Donat (cd_at_[hidden])
Date: 2017-01-26 08:16:41


Hi,

Am 26.01.2017 10:41, schrieb Hans Dembinski:
>>> Note that I am still resisting the idea of .str() as a member
>>> function. If
>>> the joiner or concatenation object exports begin() and end(), it's
>>> un-necessary, because the object returned by create_string() (or
>>> similar)
>>> can use the iterators.
>>
>> I like that idea, though I still don't like the name to_string().
>>
>> How about this:
>>
>> auto s = generate<std::sting>(concat(...));
>> auto ws = generate<std::wsting>(concat(...));
>
> Why don't you add explicit conversion operators to the string factory
>
> explicit operator std::string() { … }
> explicit operator std::wstring() { … }
>
> explicit type conversion was exactly added for this situation in
> C++11. The call is then
>
> auto s = static_cast<std::string>(concat(…));

That is the worst we had up to now. Even an implicit conversion is
better, which is not at all my favourite as well.

Christof


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