From 13f83d653036bfb99b93fd18aaf3df9fb2eb1c82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 22 Apr 2020 15:06:39 +0200 Subject: [PATCH] simplify constructors --- AABB_tree/include/CGAL/AABB_tree.h | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/AABB_tree/include/CGAL/AABB_tree.h b/AABB_tree/include/CGAL/AABB_tree.h index 30e71319bf1..2e9c17f8327 100644 --- a/AABB_tree/include/CGAL/AABB_tree.h +++ b/AABB_tree/include/CGAL/AABB_tree.h @@ -574,7 +574,7 @@ public: // set of input primitives Primitives m_primitives; // single root node - Node* m_p_root_node; + Node* m_p_root_node = nullptr; #ifdef CGAL_HAS_THREADS mutable CGAL_MUTEX build_mutex; // mutex used to protect const calls inducing build() and build_kd_tree() #endif @@ -603,14 +603,14 @@ public: } // search KD-tree - const Search_tree* m_p_search_tree; - bool m_use_default_search_tree; // indicates whether the internal kd-tree should be built + const Search_tree* m_p_search_tree = nullptr; + bool m_use_default_search_tree = true; // indicates whether the internal kd-tree should be built #ifdef CGAL_HAS_THREADS std::atomic m_atomic_need_build; std::atomic m_atomic_search_tree_constructed; #else - bool m_need_build; - bool m_search_tree_constructed; + bool m_need_build = false; + bool m_search_tree_constructed = false; #endif private: @@ -626,16 +626,9 @@ public: template AABB_tree::AABB_tree(const Tr& traits) : m_traits(traits) - , m_primitives() - , m_p_root_node(nullptr) - , m_p_search_tree(nullptr) - , m_use_default_search_tree(true) #ifdef CGAL_HAS_THREADS , m_atomic_need_build(false) , m_atomic_search_tree_constructed(false) -#else - , m_need_build(false) - , m_search_tree_constructed(false) #endif {} @@ -644,17 +637,9 @@ public: AABB_tree::AABB_tree(ConstPrimitiveIterator first, ConstPrimitiveIterator beyond, T&& ... t) - : m_traits() - , m_primitives() - , m_p_root_node(nullptr) - , m_p_search_tree(nullptr) - , m_use_default_search_tree(true) #ifdef CGAL_HAS_THREADS - , m_atomic_need_build(false) + : m_atomic_need_build(false) , m_atomic_search_tree_constructed(false) -#else - , m_need_build(false) - , m_search_tree_constructed(false) #endif { // Insert each primitive into tree