2013/11/20 Bjorn Reese <breese@mail1.stofanet.dk>
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