|
Boost : |
From: Jeff Garland (jeff_at_[hidden])
Date: 2002-02-03 22:47:52
Jon Wang wrote:
> I'm afraid that using template specialization might not sucess,
> because only could it deal with the floating pointer types.
By floating point types I meant both float and double. So there would have to
be 2 specializations that call a common function. If specialization isn't
appropriate then I would suggest that always setting the precision would be an
appropriate solution. It certainly hurts performance, but lexical_cast isn't
the highest performance solution to start with.
> ...snip....
> string a = lexical_cast<string>(123.123456)<<setprecision(10);
> cout<<a<<endl;
> a = lexical_cast<string>(123.123456);
My opinion is that lexical_cast should not require the user to control the
precision at the interface. It doesn't seem much like a "cast" when a
manipulator has to be applied.
No matter what, I think this needs to be fixed. Kevlin you out there?
Jeff
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk