From: Stéphane Bronsart (stephane.bronsart_at_[hidden])
Date: 2002-07-02 09:18:36
Here is my proposal for lexical_cast :
template<typename Target, typename Source>
Target lexical_cast(Source arg)
stringstream interpreter, inter2; // for out-of-the-box g++ 2.95.2
if(!(interpreter << arg) || !(interpreter >> result) ||
!(interpreter >> ws).eof())
if(!(inter2 << result) || !(inter2 >> copy_of_arg) )
if( copy_of_arg != arg ) //
<<<< If all is ok, normaly copy_of_arg and arg MUST be the same !!!
If not, exception occurs.
I'm not use with boost and/or library.
If you think this solution good, ok.
If you think you have to adapt, ok.
If you think its bad, please tell me why.
But for me, all conversion are now ok or exception is throw.
Thus it's Ok.
I'm waiting message from you.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk