Boost logo

Boost :

From: Michiel Salters (michiel.salters_at_[hidden])
Date: 2002-09-18 03:23:38


> -----Original Message-----
> From: Stefan Hojer [mailto:redcube_at_[hidden]]
> Sent: dinsdag 17 september 2002 11:27
> To: boost_at_[hidden]
> Subject: [boost] error in in boost::lexical_cast<string>(char)
>
>
> The following code works fine:
>
> boost::lexical_cast<std::string>('a');
>
> but if the parameter is a whitespace-character, the code throws an
> exception:
>
> boost::lexical_cast<std::string>(' ');

Is this in generic code? If not, you can use std::string( 1, ' ' ) to create
this string.

What happened is that a lexical_cast to string fails if there is any
whitespace in the textual representation of the source type. ' ' is
just the simplest example.

Regards,

-- 
Michiel Salters     Consultant Software Engineering
CMG RTSE1
Michiel.Salters_at_[hidden]

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