Boost logo

Boost :

Subject: Re: [boost] Formal Review Request: Boost.String.Convert
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2009-02-17 17:59:04

On Tue, Feb 17, 2009 at 12:33 PM, Andrey Semashev
<andrey.semashev_at_[hidden]> wrote:
> David Abrahams wrote:
>> on Tue Feb 17 2009, Emil Dotchevski <> wrote:
>>> For example, to_string<int>(s) could also be written as
>>> convert<int>(s).
>> Probably just a slip of the mind, but:
>> to_string doesn't need a template parameter.
> Actually, it does, since I might want different string types to get. Right
> now there are string and wstring, and more are coming in C++0x.

I've needed to convert things specifically to std::string plenty of
times to justify a simple interface where to_string returns
std::string. I want to be able, in a header file, to just say:

struct foo;
std::string to_string( foo const & );
std::string to_string( foo const &, fmt );

and be done with it. In my mind, the motivation for such an interface
is to standardize what fmt is (so that users have a consistent way of
formatting foos and bars) and to provide helper functions for dealing
with (and possibly extending) fmt (so that it's easy to implement
converting foo to a string.)

Emil Dotchevski
Reverge Studios, Inc.

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