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); }