On 10/16/05 3:01 PM, "Mats Eklund"
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