remove_if predicate

Consider a cookie factory with a quality control problem:

  class Cookie
  {
      public:
       Cookie(int n_chips, float diameter)
        : n_chips_(n_chips), diameter_(diameter) {}
     int number_of_chips() const {return n_chips_;}
     float diameter()   const {return diameter_;}

  private:
     int n_chips_;
     float diameter_;
  };  

We've got a container of cookies and we need to erase all those cookies that either have too few chips, or are too small in diameter:

  v.erase(
     remove_if(v.begin(), v.end(),
        bind(logical_or<bool>(),
           bind(less<int>(), bind(&Cookie::number_of_chips,  _1), 50),
           bind(less<float>(), bind(&Cookie::diameter, _1),  5.5F)
        )
     ),

     v.end()
  );  

Note that the above continues to work whether our container holds Cookie, Cookie*, or some smart_ptr<Cookie>.