This question is a style question as you can always write a for loop or something similar; however, is there a less intrusive equivalent of STL or BOOST to write:
for (container<type>::iterator iter = cointainer.begin(); iter != cointainer.end(); iter++) iter->func();
?
Something like (imaginary):
call_for_each(container.begin(), container.end(), &Type::func);
I think it would be 1) less typing, 2) easier to read, 3) fewer changes if you decide to change the type of the base type / container type.
EDIT: Thanks for your help, now, what if I wanted to pass some arguments to a member function?
c ++ boost coding-style stl
kyku
source share