Better name needed for applying a function on elements of a container
Posted
by stefaanv
on Stack Overflow
See other posts from Stack Overflow
or by stefaanv
Published on 2010-05-26T09:03:43Z
Indexed on
2010/05/26
9:11 UTC
Read the original article
Hit count: 229
I have a container class (containing a multi-index container) for which I have a public "foreach" member-function, so users can pass a functor to apply on all elements.
While implementing, I had a case where the functor should only be applied to some elements of a range in the container, so I overloaded the foreach, to pass some valid range.
Now, in some cases, it was worthwhile to stop on a certain condition, so practically, I let the foreach stop based on the return-value of the function.
I'm pleased with how the system works, but I have one concern:
How should a "foreach" on a range, with stop conditions be called?
Anyone knows a generic, clear and concise name?
© Stack Overflow or respective owner