|
Boost : |
From: Gennaro Prota (gennaro_prota_at_[hidden])
Date: 2006-07-03 12:57:44
On Thu, 29 Jun 2006 18:58:26 +0200, "Boris" <boriss_at_[hidden]> wrote:
>Yes, I use now "something like this". :) However I wonder if there is
>something more comfortable.
Yes, writing a small percentage class ;) boost::lexical_cast is about
textual conversions, as performed by a standard stream with no special
formatting (with a special treatment, explained in the docs, for
string targets). "60%" is not a textual representation of a double in
the standard lib view of things, thus you have no luck with that; but
you can decide how *your classes* are streamed. Requirements indicated
here
<http://www.boost.org/libs/conversion/lexical_cast.htm#lexical_cast>
are to be fulfilled for the class to work with lexical_cast<>.
-- [ Gennaro Prota, C++ developer for hire ] [ resume: available on request ]
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk