From: Neal D. Becker (ndbecker2_at_[hidden])
Date: 2004-05-14 07:03:53
Vladimir Prus wrote:
> Neal D. Becker wrote:
>> Thanks for the advice. I think I have it now.
>> A function F accepts a pair of stl-style iterators as input. A nullary
>> functor G can generate an output. Arrange for F to call G n times
>> without storing to an intermediate sequence.
>> Example: G is a random number generator.
>> I wonder if there is a more elegant approach?
> As for improving this, I also have two ideas:
> 1. Some time ago I've created an utility class for creating input
> iterators, called "eof_iterator". Reimplementing function_input_iterator
> with it yeilds somewhat smaller code, see:
> the eof iterator itself is at:
I love it! Just one small improvement:
eof_iterator add parameter:
template<class Derived, class ValueType, class
class eof_iterator : public iterator_facade<Derived, const ValueType,
And change function_input_iterator:
class function_input_iterator2 : public boost::eof_iterator<
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk