Boost logo

Boost Users :

Subject: Re: [Boost-users] [String_Ref] Working with other parts of boost
From: Antony Polukhin (antoshkka_at_[hidden])
Date: 2013-11-20 07:45:39


2013/11/20 Bjorn Reese <breese_at_[hidden]>

> On 11/20/2013 09:31 AM, Antony Polukhin wrote:
>
> There is a plan to add optimizations for string_ref to lexical_cast so
>> there'll be minimal difference in performance.
>>
>
> That is good news. Can this be extended to any type that fulfils the
> Single Pass Range (or the Forward Range) concept?

No, that's impossible: lexical_cast must convert data as if it was passed
via operator<<. Optimizations can be added to some types with exactly known
behavior: iterator_range<char*>, basic_string_ref<char>. There's no way to
optimize iterator_range<SomeUserDefinedType> because user may have provided
it's own specialization of operator<< for
iterator_range<SomeUserDefinedType> that works differently from default
operator<< for iterator_range.

-- 
Best regards,
Antony Polukhin


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net