Boost logo

Boost :

Subject: Re: [boost] Formal Review Request: Boost.String.Convert
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2009-02-17 14:19:47

Emil Dotchevski wrote:
> I like the idea of a library for converting to and from strings.
> I have two comments:
> 1) I don't like the string namespace. I would prefer to use
> boost::to_string and boost::from_string:
> std::string s=boost::to_string(x)
> reads better than
> std::string s=boost::string::to(x).

We had a hot discussion on the naming issue just recently.

The outcome was that to_string/from_string are not verbs, are slightly
longer than convert and duplicate the namespace name; to/from are
meaningless without the surrounding namespace name, which may be omitted
or mangled with aliases.

> 2) What's the motivation for the convert function? Is it supposed to
> convert anything to anything? (It seems to me the motivation is to
> mimic the lexical_cast functionality but I don't think that's
> necessary.)

The convert function will eventually convert different things to strings
and vice versa. So far conversion between strings and numeric types and
between strings of different types were extensively discussed. The
background for not extending lexical_cast is also expressed in the
initial post of the aforementioned thread.

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