Boost logo

Boost :

Subject: Re: [boost] Formal Review Request: Boost.String.Convert
From: Christopher Jefferson (chris_at_[hidden])
Date: 2009-02-18 19:06:11

On 18 Feb 2009, at 23:30, Andrey Semashev wrote:

> Emil Dotchevski wrote:
>>>> (Though as it is evident, you'll still have hard time convincing me
>>>> that when all I need is to convert a foo to std::string, I have
>>>> to use
>>>> "the mother of all conversions" library instead of the straight
>>>> forward to_string.)
>>> Perhaps. I still don't understand why would you want to use specific
>>> functions, like to_string/to_wstring/to_whatever_string(foo)
>>> instead of a
>>> unified interface function convert< whatever >(foo).
>> The answer is the same as why I don't always use templates. I use
>> templates when I need my code to be generic, otherwise I do not.
> That's an odd argument. You do use STL containers in a non-template
> code, don't you? And perhaps you use shared_ptr< T > in a non-
> template code, too? The lexical_cast< T > may be a closer example.
> How come convert< T > to be that special?

Are you suggesting that convert should just do to and from strings? If
so, then combining it into one box seems unnecessary.

If you are suggesting it should do other things, then you are opening
a big box I don't want to go into. I do not want a unifying single
"convert" method, that turns anything into anything else, mainly
because it will gets things wrong most of the time.


>> If I want to convert to T I'll use convert<T> if I want to convert to
>> string, I prefer the much lighter s=to_string(x).
> Well, at this point it's not obvious how much lighter it is (and
> even if it is lighter at all).
> _______________________________________________
> Unsubscribe & other changes:

Boost list run by bdawes at, gregod at, cpdaniel at, john at