Angus Leeming wrote:
> Why not
>         float tostr(float value, int precision = -1)
>         {
>                 std::ostringstream ss;
>                 if (precision < 0)
>                         ss << value;
>                 else
>                         ss << setprecision(precision) << value;
>                 return ss.str();
>         }
>
>         // Ditto for 'double'.
>         double tostr(double value, int precision = -1);

I have found this advice by Terje Slettebø:
http://lists.boost.org/MailArchives/boost/msg30121.php

If this works, we could stay with boost (FWIW). I'll have a look.

> > (BTW this seems to be a restriction of boost::lexical_cast, which is
> > used in tostr. Search the web for "lexical_cast precision". Maybe
> > there's also a method for lexical_cast; I have to investigate this
> > further)
> >
> > I will come back to it after my return in a few days.
>
> Have a good trip.

Oh, thanks. It's just my usual work :-(

Jürgen

Reply via email to