Boost logo

Boost :

Subject: Re: [boost] Porting boost::lexical_cast tests to boost::convert
From: Matthew Chambers (matt.chambers42_at_[hidden])
Date: 2011-05-03 19:09:54


On 5/3/2011 9:13 AM, Jeroen Habraken wrote:
> Hi,
>
> Since boost::convert is promoting itself as an alternative to
> boost::lexical_cast I decided to port the boost::lexical_cast test
> suite (which can be found in
> BOOST_ROOT/libs/conversion/lexical_cast_test.cpp) to boost::convert.
> I've simply replaced lexical_cast<T>(U) with convert<T>::from(U) and
> bad_lexical_cast with std::invalid_argument, whether this is a valid
> approach I'm not sure. To actually get the test suite to compile for
> boost::convert I had to comment out a lot of them and even then there
> are quite a few failures. This needs to be looked at (I've attached
> the code), what are actual boost::convert failures (both at compile-
> and runtime) and what is caused by my porting?
>

Hi Jeroen, I think your approach here is quite reasonable for testing convert as a drop-in
replacement for lexical_cast. How do the results change when you add .value() to the end to avoid
the implicit conversion? I suspect that would fix a lot of the issues. Whether we like having to add
that to achieve drop-in compatibility is something to discuss.

-Matt


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