...

/

opApply & opApplyReverse Member Functions

opApply & opApplyReverse Member Functions

Understand foreach support by opApply and opApplyReverse member functions.

foreach, opApply, and opApplyReverse

Everything that is said about opApply in this section is valid for opApplyReverse as well. opApplyReverse is for defining the behaviors of objects in the foreach_reverse loops.

The member functions above allow us to use objects as ranges. That method is more suitable when there is only one sensible way of iterating over a range. For example, it would be easy to provide access to individual students of a Students type.

On the other hand, sometimes it makes more sense to iterate over the same object in different ways. We know this from ...