Boost logo

Boost Users :

Subject: Re: [Boost-users] [lexical_cast] Locales.
From: Alexander Nasonov (alnsn_at_[hidden])
Date: 2009-03-02 11:31:07

Emre Turkay <emreturkay2 <at>> writes:

> I wonder if there is a downside of adding an optional std::locale
> argument to lexical_cast?

An optional agrument for default value had been recently discussed:

It was best summarized by David Abrahams:
> lexical_cast is conceptually simple and should remain that way.
> The proper interface for the functionality you seek should be considered
> without reference to lexical_cast.
> In fact, if we put together all the badly needed functionality that
> overlaps with lexical_cast, and give it appropriate interfaces, I'm not
> entirely convinced that there would be much use for lexical_cast
> anymore.

Kevlin Henney (the author of lexical_cast) is not convinced too:
(from off-list conversation)
> Yes, agreed. This suggestion has come up before and, although a useful
> idea, it is slightly beyond the scope of what lexical_cast should be doing.
> Over time there have been many little suggestions like this that, had
> they been accepted, would have led to severe scope drift in
> lexical_cast, turning it into something that would rival I/O streams and
> locales for complexity!
> I think this is the kind of facility that is better offered by a more
> dedicated family of conversion functions with richer interfaces.
> Regards,
> Kevlin

Good news is that Vladimir is developing a richer interface.

You can discuss your idea with him.


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at