From c741907296564fae53e2551fa6cb8687f9f77d28 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Sun, 3 Sep 2023 03:23:51 +0300 Subject: [PATCH] Switch to boost::core::invoke_swap. Add missing includes. boost::swap is deprecated and will be removed. Use boost::core::invoke_swap as a replacement. Also add missing includes. --- .../geometry/formulas/karney_inverse.hpp | 9 +++--- .../detail/rtree/node/variant_dynamic.hpp | 4 ++- .../detail/rtree/node/variant_static.hpp | 8 ++++- .../index/detail/rtree/node/weak_dynamic.hpp | 6 ++-- .../index/detail/rtree/node/weak_static.hpp | 8 +++-- .../boost/geometry/index/detail/utilities.hpp | 4 +-- .../boost/geometry/index/detail/varray.hpp | 2 -- include/boost/geometry/index/rtree.hpp | 31 ++++++++++--------- .../boost/geometry/util/series_expansion.hpp | 1 + .../rtree/exceptions/test_throwing_node.hpp | 9 +++++- 10 files changed, 51 insertions(+), 31 deletions(-) diff --git a/include/boost/geometry/formulas/karney_inverse.hpp b/include/boost/geometry/formulas/karney_inverse.hpp index 47efc9ff5e..12dd2b2598 100644 --- a/include/boost/geometry/formulas/karney_inverse.hpp +++ b/include/boost/geometry/formulas/karney_inverse.hpp @@ -32,6 +32,7 @@ #define BOOST_GEOMETRY_FORMULAS_KARNEY_INVERSE_HPP +#include #include #include @@ -191,7 +192,7 @@ class karney_inverse if (swap_point < 0) { lon12_sign *= -1; - swap(lat1, lat2); + boost::core::invoke_swap(lat1, lat2); } // Enforce lat1 to be <= 0. @@ -448,9 +449,9 @@ class karney_inverse if (swap_point < 0) { - swap(sin_alpha1, sin_alpha2); - swap(cos_alpha1, cos_alpha2); - swap(result.geodesic_scale, M21); + boost::core::invoke_swap(sin_alpha1, sin_alpha2); + boost::core::invoke_swap(cos_alpha1, cos_alpha2); + boost::core::invoke_swap(result.geodesic_scale, M21); } sin_alpha1 *= swap_point * lon12_sign; diff --git a/include/boost/geometry/index/detail/rtree/node/variant_dynamic.hpp b/include/boost/geometry/index/detail/rtree/node/variant_dynamic.hpp index c545a4160a..ba0fd7c9ac 100644 --- a/include/boost/geometry/index/detail/rtree/node/variant_dynamic.hpp +++ b/include/boost/geometry/index/detail/rtree/node/variant_dynamic.hpp @@ -16,8 +16,10 @@ #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_VARIANT_DYNAMIC_HPP #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_VARIANT_DYNAMIC_HPP +#include #include #include +#include #include #include #include @@ -184,7 +186,7 @@ class allocators void swap(allocators & a) { - boost::swap(node_allocator(), a.node_allocator()); + boost::core::invoke_swap(node_allocator(), a.node_allocator()); } bool operator==(allocators const& a) const { return node_allocator() == a.node_allocator(); } diff --git a/include/boost/geometry/index/detail/rtree/node/variant_static.hpp b/include/boost/geometry/index/detail/rtree/node/variant_static.hpp index c1612b9853..e0150a7033 100644 --- a/include/boost/geometry/index/detail/rtree/node/variant_static.hpp +++ b/include/boost/geometry/index/detail/rtree/node/variant_static.hpp @@ -15,6 +15,12 @@ #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_VARIANT_STATIC_HPP #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_VARIANT_STATIC_HPP +#include +#include +#include +#include +#include + #include #include @@ -146,7 +152,7 @@ class allocators void swap(allocators & a) { - boost::swap(node_allocator(), a.node_allocator()); + boost::core::invoke_swap(node_allocator(), a.node_allocator()); } bool operator==(allocators const& a) const { return node_allocator() == a.node_allocator(); } diff --git a/include/boost/geometry/index/detail/rtree/node/weak_dynamic.hpp b/include/boost/geometry/index/detail/rtree/node/weak_dynamic.hpp index 8c2ec41475..6db7161ee9 100644 --- a/include/boost/geometry/index/detail/rtree/node/weak_dynamic.hpp +++ b/include/boost/geometry/index/detail/rtree/node/weak_dynamic.hpp @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include @@ -228,8 +228,8 @@ class allocators void swap(allocators & a) { - boost::swap(internal_node_allocator(), a.internal_node_allocator()); - boost::swap(leaf_allocator(), a.leaf_allocator()); + boost::core::invoke_swap(internal_node_allocator(), a.internal_node_allocator()); + boost::core::invoke_swap(leaf_allocator(), a.leaf_allocator()); } bool operator==(allocators const& a) const { return leaf_allocator() == a.leaf_allocator(); } diff --git a/include/boost/geometry/index/detail/rtree/node/weak_static.hpp b/include/boost/geometry/index/detail/rtree/node/weak_static.hpp index a1a5988643..9569afc56c 100644 --- a/include/boost/geometry/index/detail/rtree/node/weak_static.hpp +++ b/include/boost/geometry/index/detail/rtree/node/weak_static.hpp @@ -15,6 +15,10 @@ #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_WEAK_STATIC_HPP #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_WEAK_STATIC_HPP +#include +#include +#include + #include #include @@ -155,8 +159,8 @@ class allocators void swap(allocators & a) { - boost::swap(internal_node_allocator(), a.internal_node_allocator()); - boost::swap(leaf_allocator(), a.leaf_allocator()); + boost::core::invoke_swap(internal_node_allocator(), a.internal_node_allocator()); + boost::core::invoke_swap(leaf_allocator(), a.leaf_allocator()); } bool operator==(allocators const& a) const { return leaf_allocator() == a.leaf_allocator(); } diff --git a/include/boost/geometry/index/detail/utilities.hpp b/include/boost/geometry/index/detail/utilities.hpp index 9060071b33..afe122904b 100644 --- a/include/boost/geometry/index/detail/utilities.hpp +++ b/include/boost/geometry/index/detail/utilities.hpp @@ -12,7 +12,7 @@ #include -#include +#include #ifndef BOOST_GEOMETRY_INDEX_DETAIL_UTILITIES_HPP #define BOOST_GEOMETRY_INDEX_DETAIL_UTILITIES_HPP @@ -40,7 +40,7 @@ static inline void move_cond(T &, T &, std::false_type) {} template inline void swap_cond(T & l, T & r, std::true_type) { - ::boost::swap(l, r); + ::boost::core::invoke_swap(l, r); } template inline diff --git a/include/boost/geometry/index/detail/varray.hpp b/include/boost/geometry/index/detail/varray.hpp index 9911520bbb..4d010cb828 100644 --- a/include/boost/geometry/index/detail/varray.hpp +++ b/include/boost/geometry/index/detail/varray.hpp @@ -21,7 +21,6 @@ #include #include #include -#include #include // TODO - use std::reverse_iterator and std::iterator_traits @@ -1566,7 +1565,6 @@ class varray { //std::iter_swap(first_sm, first_la); //std::swap(*first_sm, *first_la); // may throw - //boost::swap(*first_sm, *first_la); value_type temp(std::move(*first_sm)); // may throw *first_sm = std::move(*first_la); // may throw *first_la = std::move(temp); // may throw diff --git a/include/boost/geometry/index/rtree.hpp b/include/boost/geometry/index/rtree.hpp index 425dae965a..584a77624b 100644 --- a/include/boost/geometry/index/rtree.hpp +++ b/include/boost/geometry/index/rtree.hpp @@ -24,6 +24,7 @@ // Boost #include #include +#include // Boost.Geometry #include @@ -657,9 +658,9 @@ class rtree src.m_members.parameters(), std::move(src.m_members.allocators())) { - boost::swap(m_members.values_count, src.m_members.values_count); - boost::swap(m_members.leafs_level, src.m_members.leafs_level); - boost::swap(m_members.root, src.m_members.root); + boost::core::invoke_swap(m_members.values_count, src.m_members.values_count); + boost::core::invoke_swap(m_members.leafs_level, src.m_members.leafs_level); + boost::core::invoke_swap(m_members.root, src.m_members.root); } /*! @@ -683,9 +684,9 @@ class rtree { if ( src.m_members.allocators() == allocator ) { - boost::swap(m_members.values_count, src.m_members.values_count); - boost::swap(m_members.leafs_level, src.m_members.leafs_level); - boost::swap(m_members.root, src.m_members.root); + boost::core::invoke_swap(m_members.values_count, src.m_members.values_count); + boost::core::invoke_swap(m_members.leafs_level, src.m_members.leafs_level); + boost::core::invoke_swap(m_members.root, src.m_members.root); } else { @@ -758,9 +759,9 @@ class rtree m_members.equal_to() = src.m_members.equal_to(); m_members.parameters() = src.m_members.parameters(); - boost::swap(m_members.values_count, src.m_members.values_count); - boost::swap(m_members.leafs_level, src.m_members.leafs_level); - boost::swap(m_members.root, src.m_members.root); + boost::core::invoke_swap(m_members.values_count, src.m_members.values_count); + boost::core::invoke_swap(m_members.leafs_level, src.m_members.leafs_level); + boost::core::invoke_swap(m_members.root, src.m_members.root); // NOTE: if propagate is true for std allocators on darwin 4.2.1, glibc++ // (allocators stored as base classes of members_holder) @@ -795,9 +796,9 @@ class rtree */ void swap(rtree & other) { - boost::swap(m_members.indexable_getter(), other.m_members.indexable_getter()); - boost::swap(m_members.equal_to(), other.m_members.equal_to()); - boost::swap(m_members.parameters(), other.m_members.parameters()); + boost::core::invoke_swap(m_members.indexable_getter(), other.m_members.indexable_getter()); + boost::core::invoke_swap(m_members.equal_to(), other.m_members.equal_to()); + boost::core::invoke_swap(m_members.parameters(), other.m_members.parameters()); // NOTE: if propagate is true for std allocators on darwin 4.2.1, glibc++ // (allocators stored as base classes of members_holder) @@ -808,9 +809,9 @@ class rtree > propagate; detail::swap_cond(m_members.allocators(), other.m_members.allocators(), propagate()); - boost::swap(m_members.values_count, other.m_members.values_count); - boost::swap(m_members.leafs_level, other.m_members.leafs_level); - boost::swap(m_members.root, other.m_members.root); + boost::core::invoke_swap(m_members.values_count, other.m_members.values_count); + boost::core::invoke_swap(m_members.leafs_level, other.m_members.leafs_level); + boost::core::invoke_swap(m_members.root, other.m_members.root); } /*! diff --git a/include/boost/geometry/util/series_expansion.hpp b/include/boost/geometry/util/series_expansion.hpp index bdc4d7c6eb..55c8b8f2fc 100644 --- a/include/boost/geometry/util/series_expansion.hpp +++ b/include/boost/geometry/util/series_expansion.hpp @@ -30,6 +30,7 @@ #ifndef BOOST_GEOMETRY_UTIL_SERIES_EXPANSION_HPP #define BOOST_GEOMETRY_UTIL_SERIES_EXPANSION_HPP +#include #include #include diff --git a/index/test/rtree/exceptions/test_throwing_node.hpp b/index/test/rtree/exceptions/test_throwing_node.hpp index e245d79642..7f2228ce87 100644 --- a/index/test/rtree/exceptions/test_throwing_node.hpp +++ b/index/test/rtree/exceptions/test_throwing_node.hpp @@ -13,6 +13,13 @@ #define BOOST_GEOMETRY_INDEX_TEST_RTREE_THROWING_NODE_HPP #include +#include +#include +#include +#include +#include +#include +#include struct throwing_nodes_stats { @@ -235,7 +242,7 @@ class allocators void swap(allocators & a) { - boost::swap(node_allocator(), a.node_allocator()); + boost::core::invoke_swap(node_allocator(), a.node_allocator()); } bool operator==(allocators const& a) const { return node_allocator() == a.node_allocator(); }