Boost logo

Boost :

Subject: Re: [boost] [lexical cast] Performance improvements
From: Antony Polukhin (antoshkka_at_[hidden])
Date: 2011-04-05 11:39:57

>From Gruenke, Matt

>>From Vicente BOTET, on Mon 4/4/2011 5:59 PM:

>> I think that it is better to improve my library that is there to manage with any conversion, and let lexical cast do what it did originally.

>> Let me know what do you think.


>It didn't sound like he change the behavior of lexical_cast<>(), at all. I am very much in favor of these optimizations going in, since I have a large >amount of code which uses lexical_cast<>().

Yes, I did not changed the behavior of the library, but only added
optimizations for some conversions, which sometimes occur when
lexical_cast is used in generic programming. There are some more
optimizations for lexical_cast in bug database (tickets #5417 and

>From Vicente BOTET

> Let me know what do you think.


> Best,

> Vicente

I`ve looked at Boost.Conversion library at sandbox/conversion/. The
idea is interesting, but:


char ch = '0';

std::cout << boost::lexical_cast<int>(ch) << " " <<

This code will output "0 48"

We can not make your library output both values... There are some
tags, but in both cases it will be boost::dummy::type_tag<char> (or
may be I didn`t get the idea)

2) For each conversation user will need to write
convert_to<required_type> function overload. It will be much better,
if user was required to write only one conversion function (to some
intermediate type), and the library will be able to convert to any
other type from intermediate type.

I use lexical_cast<>() a lot, so I`d better improve it first.

Boost list run by bdawes at, gregod at, cpdaniel at, john at