Boost logo

Boost :

Subject: Re: [boost] Boost.Convert. Take 2.
From: alex (alexhighviz_at_[hidden])
Date: 2014-02-21 05:48:32


>>All loops are actually like
>>
>>for (int k = 0; k < local::num_cycles; ++k)
>>{
>> int k = boost::convert<int>::from("12345", ccnv).value();
>> BOOST_ASSERT(k == 12345);
>>}
>>
>>Do you think there still might be something I missed?
>
>The assertion won't help in an optimized build, of course. Save the values
and
>print them at the end, after you've captured the elapsed times.
>

Isn't it also a problem that the inside of the loop doesn't vary? A smart
compiler may decide to evaluate boost::convert<int>::from("12345",
ccnv).value() only once and re-use the result?
Alex


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