|
Boost : |
Subject: Re: [boost] Introduction of numeric_adaptor
From: Stefan Strasser (strasser_at_[hidden])
Date: 2009-11-02 15:26:02
Am Monday 02 November 2009 19:51:34 schrieb Gottlob Frege:
> On Sun, Nov 1, 2009 at 4:16 PM, Bruno Lalande <bruno.lalande_at_[hidden]>
wrote:
> > Example:
> >
> > template <class T>
> > T my_robustness_sensitive_function(T value)
> > {
> > value /= 2;
> > T value2 = boost::to<T>("123.0123456789");
> > return value;
> > };
>
> Not sure about the to<> - it is a bit small/ambiguous to not have a
> namespace.
what's wrong with lexical_cast?
it would put the requirement of operator<< on the number type T, but I don't
see how that is worse than specializing a new boost::to template for each
number type.
a number type T most likely supports streaming anyway, and lexical_cast is
implemented by streaming from a std::stringstream
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk