Boost logo

Boost :

From: Stephen Silver (boost_at_[hidden])
Date: 2001-01-21 18:43:31

Paul Moore wrote:

> >
> This is nice. Would you have any objections to me including it in
> the rational library, as a regression test?

No objections. I already gave it a Boost-compliant copyright notice.

> lcm bugs fixed. However, I think you are mistaken over the
> operator>> errors - remember that >> consumes as much input as
> it can, only setting the error state if it cannot construct a valid value.
> Your example
> std::istringstream iss("57A");
> iss >> r0;
> consumes "57". This is a valid representation of a rational, namely
> 57/1, so r0 is set to this, and the stream is in a good state.

OK. But in that case the documentation needs changing, because it

    The external representation of a rational is two integers,
    separated by a slash (/). On input, there must be no space
    between the numerator and the slash.

which seems to imply that anything without a / is not a valid input.
(Also, the above requirement seems lacking in symmetry. Would it not
be better if it either allowed spaces both sides of the / or disallowed
them both sides?)


Boost list run by bdawes at, gregod at, cpdaniel at, john at