//Don't keep writing list loops, use functors!
class Base
{
public:
virtual ~Base(){};
typedef std::list List;
struct Functor
{
virtual ~Functor(){}
virtual void operator()(Base& o) const=0;
};
static void Functorator(List& l, const Functor& f)
{
for (List::iterator it=l.begin();
it!=l.end(); ++it)
{
f(*(*it));
}
}
};
Neapolitan
4 years ago
No comments:
Post a Comment