From 7990fd4f27d9d44320a87130cb54a29087ecfa55 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Mon, 8 Oct 2018 14:05:30 +0200 Subject: [PATCH 1/4] Add an overload to build() for shared data --- AABB_tree/include/CGAL/AABB_tree.h | 74 ++++++++++++++++++++++++++++-- 1 file changed, 71 insertions(+), 3 deletions(-) diff --git a/AABB_tree/include/CGAL/AABB_tree.h b/AABB_tree/include/CGAL/AABB_tree.h index d4275852147..ff6382242c4 100644 --- a/AABB_tree/include/CGAL/AABB_tree.h +++ b/AABB_tree/include/CGAL/AABB_tree.h @@ -145,7 +145,7 @@ namespace CGAL { template AABB_tree(InputIterator first, InputIterator beyond,T1&,T2&,T3&,T4&); template - AABB_tree(InputIterator first, InputIterator beyond,T1&,T2&,T3&,T4&,T5&); + AABB_tree(InputIterator first, InputIterator beyond,T1&,T2&,T3&,T4&,T5&); #endif /// After one or more calls to `insert()` the internal data @@ -156,7 +156,31 @@ namespace CGAL { /// `build()` explicitly to ensure that the next call to /// query functions will not trigger the reconstruction of the /// data structure. + /// The parameter pack `T` is of any types + /// such that `Primitive` has a constructor with the following signature: + /// `Primitive(%InputIterator, T...)`. A call to `AABBTraits::set_shared_data(t...)` + /// is made using the internally stored traits. + /// For compilers that do not support variadic templates, + /// overloads up to 5 template arguments are provided. + +#if !defined(CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES) && !defined(CGAL_CFG_NO_CPP0X_RVALUE_REFERENCE) + template + void build(T&& ...); void build(); +#else + void build(); + template + template + void build(T1& t1); + template + void build(T1& t1, T2& t2); + template + void build(T1& t1, T2& t2, T3& t3); + template + void build(T1& t1, T2& t2, T3& t3, T4& t4); + template + void build(T1& t1, T2& t2, T3& t3, T4& t4, T5& t5); +#endif ///@} /// \name Operations @@ -728,7 +752,7 @@ public: ConstPrimitiveIterator beyond, T&& ... t) { - set_shared_data(std::forward(t)...); + set_shared_data(std::forward(t)...); while(first != beyond) { m_primitives.push_back(Primitive(first,std::forward(t)...)); @@ -752,6 +776,14 @@ public: build(); } + + template + template + void AABB_tree::build(T&& ... t) + { + set_shared_data(std::forward(t)...); + build(); + } #else //=============constructor====================== template @@ -1033,6 +1065,42 @@ public: build(); } + //overloads calling set_shared_data() + template + template + void AABB_tree::build(T1& t1) + { + set_shared_data(t1); + build(); + } + template + template + void AABB_tree::build(T1& t1, T2& t2) + { + set_shared_data(t1, t2); + build(); + } + template + template + void AABB_tree::build(T1& t1, T2& t2, T3& t3) + { + set_shared_data(t1, t2, t3); + build(); + } + template + template + void AABB_tree::build(T1& t1, T2& t2, T3& t3, T4& t4) + { + set_shared_data(t1, t2, t3, t4); + build(); + } + template + template + void AABB_tree::build(T1& t1, T2& t2, T3& t3, T4& t4, T5& t5) + { + set_shared_data(t1, t2, t3, t4, t5); + build(); + } #endif template @@ -1062,7 +1130,7 @@ public: // constructs the tree m_p_root_node->expand(m_primitives.begin(), m_primitives.end(), - m_primitives.size(), m_traits); + m_primitives.size(), m_traits); } From 79e54aedd84d85ee7d779030089d61f43241d092 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Mon, 8 Oct 2018 14:26:44 +0200 Subject: [PATCH 2/4] indentation --- AABB_tree/include/CGAL/AABB_tree.h | 32 +++++++++++++++--------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/AABB_tree/include/CGAL/AABB_tree.h b/AABB_tree/include/CGAL/AABB_tree.h index ff6382242c4..0239cf99981 100644 --- a/AABB_tree/include/CGAL/AABB_tree.h +++ b/AABB_tree/include/CGAL/AABB_tree.h @@ -145,7 +145,7 @@ namespace CGAL { template AABB_tree(InputIterator first, InputIterator beyond,T1&,T2&,T3&,T4&); template - AABB_tree(InputIterator first, InputIterator beyond,T1&,T2&,T3&,T4&,T5&); + AABB_tree(InputIterator first, InputIterator beyond,T1&,T2&,T3&,T4&,T5&); #endif /// After one or more calls to `insert()` the internal data @@ -752,7 +752,7 @@ public: ConstPrimitiveIterator beyond, T&& ... t) { - set_shared_data(std::forward(t)...); + set_shared_data(std::forward(t)...); while(first != beyond) { m_primitives.push_back(Primitive(first,std::forward(t)...)); @@ -778,9 +778,9 @@ public: } template - template - void AABB_tree::build(T&& ... t) - { + template + void AABB_tree::build(T&& ... t) + { set_shared_data(std::forward(t)...); build(); } @@ -1068,40 +1068,40 @@ public: //overloads calling set_shared_data() template template - void AABB_tree::build(T1& t1) - { + void AABB_tree::build(T1& t1) + { set_shared_data(t1); build(); } template template - void AABB_tree::build(T1& t1, T2& t2) - { + void AABB_tree::build(T1& t1, T2& t2) + { set_shared_data(t1, t2); build(); } template template - void AABB_tree::build(T1& t1, T2& t2, T3& t3) - { + void AABB_tree::build(T1& t1, T2& t2, T3& t3) + { set_shared_data(t1, t2, t3); build(); } template template - void AABB_tree::build(T1& t1, T2& t2, T3& t3, T4& t4) - { + void AABB_tree::build(T1& t1, T2& t2, T3& t3, T4& t4) + { set_shared_data(t1, t2, t3, t4); build(); } template template - void AABB_tree::build(T1& t1, T2& t2, T3& t3, T4& t4, T5& t5) - { + void AABB_tree::build(T1& t1, T2& t2, T3& t3, T4& t4, T5& t5) + { set_shared_data(t1, t2, t3, t4, t5); build(); } - #endif +#endif template void AABB_tree::insert(const Primitive& p) From 1b5cfa66e65e48bdee8f8ea9a19e0758e6e28b22 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Tue, 9 Oct 2018 14:55:05 +0200 Subject: [PATCH 3/4] Edit after review --- AABB_tree/include/CGAL/AABB_tree.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/AABB_tree/include/CGAL/AABB_tree.h b/AABB_tree/include/CGAL/AABB_tree.h index 0239cf99981..7cad29ba63b 100644 --- a/AABB_tree/include/CGAL/AABB_tree.h +++ b/AABB_tree/include/CGAL/AABB_tree.h @@ -156,9 +156,7 @@ namespace CGAL { /// `build()` explicitly to ensure that the next call to /// query functions will not trigger the reconstruction of the /// data structure. - /// The parameter pack `T` is of any types - /// such that `Primitive` has a constructor with the following signature: - /// `Primitive(%InputIterator, T...)`. A call to `AABBTraits::set_shared_data(t...)` + /// A call to `AABBTraits::set_shared_data(t...)` /// is made using the internally stored traits. /// For compilers that do not support variadic templates, /// overloads up to 5 template arguments are provided. @@ -1130,7 +1128,7 @@ public: // constructs the tree m_p_root_node->expand(m_primitives.begin(), m_primitives.end(), - m_primitives.size(), m_traits); + m_primitives.size(), m_traits); } From 34527a3dc3c65a6eb522526bc8df8f6f8b824cc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 31 Oct 2018 06:20:37 +0100 Subject: [PATCH 4/4] remove extra template keyword --- AABB_tree/include/CGAL/AABB_tree.h | 1 - 1 file changed, 1 deletion(-) diff --git a/AABB_tree/include/CGAL/AABB_tree.h b/AABB_tree/include/CGAL/AABB_tree.h index 7cad29ba63b..c2b88e05e41 100644 --- a/AABB_tree/include/CGAL/AABB_tree.h +++ b/AABB_tree/include/CGAL/AABB_tree.h @@ -167,7 +167,6 @@ namespace CGAL { void build(); #else void build(); - template template void build(T1& t1); template