|
Boost : |
Subject: [boost] [iterator] generator_iterator vs. function_input_iterator
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2017-08-28 18:05:50
Hi,
There seems to be two nearly equivalent components in Boost.Iterator:
generator_iterator (moved from Boost.Utility) and
function_input_iterator. Both are input iterators wrapping a function
object, which result is used as the dereferenced value. The difference is:
- generator_iterator always creates an instance of the element type
while function_input_iterator does that lazily;
- function_input_iterator uses result_of while generator_iterator relies
on C++03 T::result_type
- equality comparison is different: generator_iterators compares equal
if both refer to the same generator and cached element instances are
equal while function_input_iterator uses an additional state (which can
be viewed as an index) for comparison instead of the cached element.
So basically, they are the same thing. generator_iterator looks a bit
more dated and IMHO its comparison implementation is not as robust as
that of function_input_iterator, so maybe we should deprecate it?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk