Boost logo

Boost Users :

From: Anakreon (anakreonmejdi_at_[hidden])
Date: 2005-09-28 09:11:59


I tried to create a predicate based on lambda expressions.
The attempt failed with compiler errors so finally I created
a struct to do the job.
The problem is:
I have a vector with pointers of objects of class Event.
vector<Event*> events
and want to call find_if on the vector.
The struct which does this is:
struct event_locator: public unary_function<bool, Event*> {
   int tId;
   event_locator(const int tid) : tId(tid) {}
   const bool operator() (Event* e) {
        return e->hasTransaction()
          && e->getTransaction().getId() == tId;
   }
};

The main problem in translating the code in the struct into lambda
expressions is that I don't know how to call a method from the placeholder
like:_1->hasTransaction().
I tried _1->* &Event::hasTransaction without success.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net