Boost logo

Boost Users :

From: troy d. straszheim (troy_at_[hidden])
Date: 2005-11-14 11:57:03


On Mon, Nov 14, 2005 at 08:12:18AM -0800, Robert Ramey wrote:
> troy d. straszheim wrote:
>
> > void load(double & t)
> > {
> > if(is.fail())
> > boost::throw_exception(archive_exception(archive_exception::stream_error));
> > char c = is.peek(); while (c == ' ' || c == '\t' || c == '\n') //
> > munch leading whitespace { is.get(); c = is.peek(); } if (c == 'n')
> > // nan { t = NAN; // you can get one of those with 0.0/0.0,
> > robert... if (is.get() != 'n' || is.get() != 'a' || is.get() != 'n')
> > boost::throw_exception(archive_exception(archive_exception::stream_error));
> > return; if (c == 'i') // positive inf { //etc, etc
> >
>
> note that text streams automatically skip white space, so this could be
> shortened considerably.
>

Did it arrive with the wrapping all screwed up like that? If so, sorry.

Anyhow the question was if factoring that all out into lexical_cast<>
(or something similar but located inside the serialization library)
makes any sense.

-t


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net