diff --git a/graphics/overlay.cpp b/graphics/overlay.cpp index dc488d138e..8e2616e1c3 100644 --- a/graphics/overlay.cpp +++ b/graphics/overlay.cpp @@ -283,35 +283,36 @@ namespace graphics { vector > v; - /// 1. collecting all elements from tree + // 1. collecting all elements from tree layer.m_tree.ForEach(MakeBackInsertFunctor(v)); - /// 2. sorting by priority, so the more important ones comes first + // 2. sorting by priority, so the more important ones comes first sort(v.begin(), v.end(), &greater_priority); - /// 3. merging them into the infoLayer starting from most - /// important one to optimize the space usage. - // @TODO Avoid std::bind overload compile error in the better way - void (Overlay::*fn)(shared_ptr const &, - math::Matrix const &) = &Overlay::processOverlayElement; - for_each(v.begin(), v.end(), bind(fn, this, _1, cref(m))); + // 3. merging them into the infoLayer starting from most + // important one to optimize the space usage. + for_each(v.begin(), v.end(), [&] (shared_ptr const & p) + { + processOverlayElement(p, m); + }); } void Overlay::merge(Overlay const & infoLayer) { vector > v; - /// 1. collecting all elements from tree + // 1. collecting all elements from tree infoLayer.m_tree.ForEach(MakeBackInsertFunctor(v)); - /// 2. sorting by priority, so the more important ones comes first + // 2. sorting by priority, so the more important ones comes first sort(v.begin(), v.end(), &greater_priority); - /// 3. merging them into the infoLayer starting from most - /// important one to optimize the space usage. - // @TODO Avoid std::bind overload compile error in the better way - void (Overlay::*fn)(shared_ptr const &) = &Overlay::processOverlayElement; - for_each(v.begin(), v.end(), bind(fn, this, _1)); + // 3. merging them into the infoLayer starting from most + // important one to optimize the space usage. + for_each(v.begin(), v.end(), [this] (shared_ptr const & p) + { + processOverlayElement(p); + }); } void Overlay::clip(m2::RectI const & r)