Reputation: 6200
Suppose a class like
class Foo
{
private:
ANonTrivialContainer bar;
OtherData baz;
};
The iterators of ANonTrivialContainer are bi-directional. From outside, I want to do stuff with the contents of bar. What is prefferable of
Upvotes: 1
Views: 79
Reputation: 8972
I would provide a visitBars
generic method, taking a functor as the parameter.
template<typename F> void visitBars(F visit) {
for(auto b: bar)
visit(b);
}
Upvotes: 1