|
Boost : |
Subject: Re: [boost] [lexical_cast] Fast conversion from boost::iterator_range<std::string::iterator>?
From: Olaf van der Spek (ml_at_[hidden])
Date: 2011-11-23 12:55:25
On Wed, Nov 23, 2011 at 5:55 PM, Matthew Chambers
<matt.chambers42_at_[hidden]> wrote:
> On Oct 13, 2011 Michel Morin wrote:
>>
>> lexical_cast made optimizations for some types (such as `std::string`)
>> to achieve better performance. But, from my experience,
>> it seems that lexical_cast does not make any optimization for
>> `boost::iterator_range<std::string::iterator>`.
>>
>> Is there any plan to add optimization for such iterator ranges?
>> Currently,
>> - `lexical_cast<int>(std::string(iter_rng.begin(), iter_rng.end()))`
>> is faster
>> than `lexical_cast<int>(iter_rng)`.
Why's that?
>> - Assuming it is safe to use `std::atoi`,
>> `std::atoi(&iter_rng.front())` is faster
>> than both of the above two methods.
Is front() guaranteed to return a 0-terminated string?
-- Olaf
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk