Boost logo

Boost :

From: Neal D. Becker (ndbecker2_at_[hidden])
Date: 2004-05-13 06:37:50


Thanks for the advice. I think I have it now.

Problem:

  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? Here is what I came up with.
It is almost perfect, there seems to be 1 extra call to G() that I haven't
accounted for, but this may or may not be important.





Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk