Boost logo

Boost Users :

From: Timmo Stange (ts_at_[hidden])
Date: 2007-02-16 15:47:02


Frank Mori Hess wrote:

> It seems to me the purpose of the cache in the slot_call_iterator is to
> prevent the slot from being run multiple times if the combiner does
> multiple dereferences on an iterator. However, since the cache is shared,
> if a copy of an already dereferenced iterator is made and incremented,
> then the original iterator will run the slot a second time when
> dereferenced. So is this a bug, or is it just unspecified what will
> happen if you dereference a slot iterator more than once?

Such a combiner would violate the single pass traversal limitation
of the input iterator concept. The cache solution allows dereferencing
the same iterator multiple times to acquire the same value without
calling the slot again, which already is a stronger guarantee than
an input iterator usually provides. The combiner example in the
docs makes use of it.

Regards

Timmo Stange


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