Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2005-03-03 15:52:14


Jonathan Turkanis wrote:

[...]

> For example, if I rewrite the following to use read instead of get
>
> template<typename Source>
> character get(Source& src)
> {
> character c = io::get(src);
> if (c.good() && c == comment_char_)
> while (c.good() && c != '\n')
> c = io::get(src);
> return c;
> }

Yes, you are right. A "proper" in-place read-based filter that implements
the above (minus the bug) is much, much harder to write and understand. It
will also be much, much faster, but the character version may be fast enough
for most uses.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk