diff options
Diffstat (limited to 'geometry')
-rw-r--r-- | geometry/tree4d.hpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/geometry/tree4d.hpp b/geometry/tree4d.hpp index f0a61bb6d0..90dec33c09 100644 --- a/geometry/tree4d.hpp +++ b/geometry/tree4d.hpp @@ -220,14 +220,20 @@ namespace m4 } template <class ToDo> - void ForEach(ToDo toDo) const + void ForEach(ToDo && toDo) const { for (ValueT const & v : m_tree) toDo(v.m_val); } + template <class ToDo> + void ForEachEx(ToDo && toDo) const + { + for (ValueT const & v : m_tree) + toDo(v.GetRect(), v.m_val); + } template <class ToDo> - bool FindNode(ToDo const & toDo) const + bool FindNode(ToDo && toDo) const { for (ValueT const & v : m_tree) if (toDo(v.m_val)) @@ -237,16 +243,14 @@ namespace m4 } template <class ToDo> - void ForEachWithRect(ToDo toDo) const + void ForEachInRect(m2::RectD const & rect, ToDo && toDo) const { - for (ValueT const & v : m_tree) - toDo(v.GetRect(), v.m_val); + m_tree.for_each(GetFunctor(rect, [&toDo] (ValueT const & v) { toDo(v.m_val); })); } - template <class ToDo> - void ForEachInRect(m2::RectD const & rect, ToDo toDo) const + void ForEachInRectEx(m2::RectD const & rect, ToDo && toDo) const { - m_tree.for_each(GetFunctor(rect, [&toDo] (ValueT const & v) { toDo(v.m_val); })); + m_tree.for_each(GetFunctor(rect, [&toDo] (ValueT const & v) { toDo(v.GetRect(), v.m_val); })); } bool IsEmpty() const { return m_tree.empty(); } |