|
Boost : |
From: Jonathan Wakely (cow_at_[hidden])
Date: 2005-08-25 05:42:20
Rupert Kittinger wrote:
> In the tuple_io.hpp header, there seems to be a slight problem in
> extract_and_check_delimiter(). The following snippet is problematic:
>
> char c;
> if (is_delimiter) {
> is >> c;
> if (c!=d) {
> is.setstate(std::ios::failbit);
> }
> }
>
> If c cannot be read because is.eof(), the result of c!=d is undefined.
IMHO the fix is neater as:
if (is>>c && c!=d)
basic_ios::operator void*() exists to support this syntax rather than
explicitly testing the state with good(), fail() etc.
jon
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk