Boost logo

Boost :

Subject: Re: [boost] [lexical_cast] A suggestion
From: Vladimir Batov (batov_at_[hidden])
Date: 2009-01-14 01:18:30


> I know that you know this but lexical_cast was designed to be
> consistent with {static,const,reinterpret}_cast<Target>(source).

Understood. I do not think though that it might be an issue. The similarity
is only cosmetic as the group is supported by the language, works with types
when lexical_cast is a library solution, works with values. So, in fact, the
user has to learn lexical_cast *not* to use it as the "real" type casts.
More so, I'd expect lexical_cast interface extended without interrupting
whatever impression/behavior the user has established in relation with the
current interface.

> It doesn't have to be named lexical_cast. Most likely you're converting
> from a string, you could name it from_string or something similar.

I indeed often (in 70%) use it for string-to-something conversion. However,
for the remaining 30% I need it beyond string-to/from conversion. As for
"from_string" I certainly had to do something along the lines for myself.
However, beyond my private sandbox I am always reluctant introducing a new
vocabulary when the existing can be sensibly reused and (IMHO) improved.

Best,
V.


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