Boost logo

Boost :

From: Michiel Salters (michiel.salters_at_[hidden])
Date: 2004-07-16 08:06:20


> -----Original Message-----
> From: boost-bounces_at_[hidden]
> [mailto:boost-bounces_at_[hidden]]On Behalf Of Jason
> Sent: vrijdag 16 juli 2004 11:03
> To: boost_at_[hidden]
> Subject: [boost] lexical_cast reviewed
>
> SOURCE CODE:
> #include <sstream>
> using namespace std;

> class lexical_cast {
> public:
> template <typename Source> lexical_cast( const Source & source ) {
> ss << source;
> }
>
> template <typename Target> operator Target() {
> Target target;
> ss >> target;
> return target;
> }
> private:
> stringstream ss;
> };

Not really lexical_cast, but useful nevertheless. Perhaps we could call it
lexical_auto_cast. It could be more efficient to store a string instead, but

I'm not sure.

Regards,
Michiel Salters

This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.


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