|
Boost Users : |
From: Daryle Walker (darylew_at_[hidden])
Date: 2005-10-22 03:26:53
On 10/16/05 3:01 PM, "Mats Eklund" <matek994_at_[hidden]> wrote:
> does anybody know whether there is something fundamentally wrong with
> designing an istream iterator that conforms with the forward, or even random
> access, iterator concepts? The std::istream_iterator conforms only with the
> simplest input iterator concept (stream need not support positioning).
[TRUNCATE]
The virtual member functions given in std::basic_istream (and
std::basic_streambuf) have enough functionality to map to iterator levels
from simple input iterator up to random access. The functions are defined
by default to be disabled or call simpler member functions in piecemeal.
The child classes override these member functions to the appropriate level.
However, there's no way for a piece of code to know how much functionality
is actually present! Imagine the performance hit if your iterators used the
stream-buffer like random access but the buffer only implemented up to
simple input. The iterator library has to assume the worst case because it
cannot tell what the actual case is.
-- Daryle Walker Mac, Internet, and Video Game Junkie darylew AT hotmail DOT com
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