diff options
author | Remko Tronçon <git@el-tramo.be> | 2012-12-23 16:01:45 (GMT) |
---|---|---|
committer | Swift Review <review@swift.im> | 2012-12-23 16:48:15 (GMT) |
commit | 5ccbd7fc3de7afed6c06deb93be3967a7eb5fac2 (patch) | |
tree | d57334bf18662d6753a2cb14bff3b192ff3e7a76 /Swiften/EventLoop | |
parent | fe5b5e25eadbfe9f8bdaa152b987273ab77d4711 (diff) | |
download | swift-5ccbd7fc3de7afed6c06deb93be3967a7eb5fac2.zip swift-5ccbd7fc3de7afed6c06deb93be3967a7eb5fac2.tar.bz2 |
Replace functors and for loops by boost::lambdas.
Change-Id: I6d2364dc85464f238d95978793f35953a2947799
Diffstat (limited to 'Swiften/EventLoop')
-rw-r--r-- | Swiften/EventLoop/EventLoop.cpp | 5 | ||||
-rw-r--r-- | Swiften/EventLoop/EventLoop.h | 5 |
2 files changed, 4 insertions, 6 deletions
diff --git a/Swiften/EventLoop/EventLoop.cpp b/Swiften/EventLoop/EventLoop.cpp index afb6858..0f78d96 100644 --- a/Swiften/EventLoop/EventLoop.cpp +++ b/Swiften/EventLoop/EventLoop.cpp @@ -12,7 +12,10 @@ #include <cassert> #include <Swiften/Base/Log.h> +#include <boost/lambda/lambda.hpp> +#include <boost/lambda/bind.hpp> +namespace lambda = boost::lambda; namespace Swift { @@ -83,7 +86,7 @@ void EventLoop::postEvent(boost::function<void ()> callback, boost::shared_ptr<E void EventLoop::removeEventsFromOwner(boost::shared_ptr<EventOwner> owner) { boost::lock_guard<boost::mutex> lock(eventsMutex_); - events_.remove_if(HasOwner(owner)); + events_.remove_if(lambda::bind(&Event::owner, lambda::_1) == owner); } } diff --git a/Swiften/EventLoop/EventLoop.h b/Swiften/EventLoop/EventLoop.h index 4a602ae..587ba22 100644 --- a/Swiften/EventLoop/EventLoop.h +++ b/Swiften/EventLoop/EventLoop.h @@ -35,11 +35,6 @@ namespace Swift { void handleEvent(const Event& event); private: - struct HasOwner { - HasOwner(boost::shared_ptr<EventOwner> owner) : owner(owner) {} - bool operator()(const Event& event) const { return event.owner == owner; } - boost::shared_ptr<EventOwner> owner; - }; boost::mutex eventsMutex_; unsigned int nextEventID_; std::list<Event> events_; |