Boost logo

Boost :

From: Bjorn Karlsson (bjorn.karlsson_at_[hidden])
Date: 2002-01-26 09:14:57


> From: Peter Dimov [mailto:pdimov_at_[hidden]]
>
> Why not make the specialization of lexical_cast use to_string? :-)
>
> What is the difference? The point is that I need a "value to string"
> facility, that works, now, on compilers without partial
> specialization.
>

I think lexical_cast should indeed use to_string - to_string doesn't need
the "default" conversion provided by lexical_cast; to_string is the
"primitive" that should be added to lexical_cast.

Furthermore, if we have to_string, we could easily make lexical_cast work
correctly by using the sizeof-trick or (which I think would be better) by
using interpreter_traits to help select the correct implementation.
No partial specialization needed and a working lexical_cast that reuses
to_string.

There were some arguments against to_string (with regards to possibilities
for enhancement of lexical_cast), but surely the above would do the trick?

Bjorn



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