
3 Mar
2005
3 Mar
'05
8:52 p.m.
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.