Boost logo

Boost :

From: Gregory Dai (gregory.dai_at_[hidden])
Date: 2007-05-09 01:48:19

On 5/8/07, Dan Day <coolmandan_at_[hidden]> wrote:
> On 5/8/07, Mathias Gaunard wrote:
> >Dean Michael Berris wrote:
> >> I still think the
> >> semantics of `lexical_cast("127")` should allow for the
> >> conversion to happen -- either convert to a 'short int' then assign to
> >> a char, if that makes any sense.
> >There is no way to distinguish int8_t and char. They are both aliases to
> >the same type.
> >Welcome to the wonderful world of typedefs.
> Maybe I'm just short-sighted, but it seems to me this really isn't a
> problem. A lexical_cast conversion from char * -> char doesn't make much
> practical sense in my mind except for grabbing the first character in the

Agreed. This is the same behavior as the std::iostreams do, as had been
pointed out by a number of people already. Let's leave it at that.

string, which can be done numerous other ways. AFAICS, lexical_cast could be
> specialized for char * -> char for such conversions as the OP desires. To
> me, that would be far more useful than the current behavior.

Nope, it's tempting to do "nice" thing, but again let's leave it at that
(see above), and close the subject.


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