From 7aac692162172ba438b537e690abca36e755e58c Mon Sep 17 00:00:00 2001 From: Christian Mazakas Date: Wed, 27 Sep 2023 12:01:46 -0700 Subject: [PATCH] Replace all usages of `boost::addressof` with their std counterpart --- .../unordered/detail/archive_constructed.hpp | 2 +- include/boost/unordered/detail/fca.hpp | 6 +++--- .../boost/unordered/detail/implementation.hpp | 20 +++++++++---------- .../unordered/detail/serialize_container.hpp | 12 +++++------ test/cfoa/helpers.hpp | 2 +- test/objects/minimal.hpp | 2 +- test/unordered/rehash_tests.cpp | 4 ++-- 7 files changed, 24 insertions(+), 24 deletions(-) diff --git a/include/boost/unordered/detail/archive_constructed.hpp b/include/boost/unordered/detail/archive_constructed.hpp index 2aa58404..b9969089 100644 --- a/include/boost/unordered/detail/archive_constructed.hpp +++ b/include/boost/unordered/detail/archive_constructed.hpp @@ -29,7 +29,7 @@ struct archive_constructed:private noncopyable template archive_constructed(const char* name,Archive& ar,unsigned int version) { - core::load_construct_data_adl(ar,boost::addressof(get()),version); + core::load_construct_data_adl(ar,std::addressof(get()),version); BOOST_TRY{ ar>>core::make_nvp(name,get()); } diff --git a/include/boost/unordered/detail/fca.hpp b/include/boost/unordered/detail/fca.hpp index a340671e..deb119b2 100644 --- a/include/boost/unordered/detail/fca.hpp +++ b/include/boost/unordered/detail/fca.hpp @@ -585,7 +585,7 @@ namespace boost { BOOST_ASSERT( this->get_node_allocator() == other.get_node_allocator()); - if (this == boost::addressof(other)) { + if (this == std::addressof(other)) { return *this; } @@ -781,9 +781,9 @@ namespace boost { void extract_node(iterator itb, node_pointer p) noexcept { - node_pointer* pp = boost::addressof(itb->next); + node_pointer* pp = std::addressof(itb->next); while ((*pp) != p) - pp = boost::addressof((*pp)->next); + pp = std::addressof((*pp)->next); *pp = p->next; if (!itb->next) unlink_bucket(itb); diff --git a/include/boost/unordered/detail/implementation.hpp b/include/boost/unordered/detail/implementation.hpp index 2f577968..d0b6960f 100644 --- a/include/boost/unordered/detail/implementation.hpp +++ b/include/boost/unordered/detail/implementation.hpp @@ -974,7 +974,7 @@ namespace boost { reference operator*() const noexcept { return dereference(); } pointer operator->() const noexcept { - pointer x = boost::addressof(p->value()); + pointer x = std::addressof(p->value()); return x; } @@ -1082,7 +1082,7 @@ namespace boost { reference operator*() const noexcept { return dereference(); } pointer operator->() const noexcept { - pointer x = boost::addressof(p->value()); + pointer x = std::addressof(p->value()); return x; } @@ -1735,8 +1735,8 @@ namespace boost { { if (size_ > 0) { key_equal pred = this->key_eq(); - for (node_pointer* pp = boost::addressof(itb->next); *pp; - pp = boost::addressof((*pp)->next)) { + for (node_pointer* pp = std::addressof(itb->next); *pp; + pp = std::addressof((*pp)->next)) { if (pred(key, extractor::extract((*pp)->value()))) { return pp; } @@ -2201,9 +2201,9 @@ namespace boost { ++next; bucket_iterator itb = pos.itb; - node_pointer* pp = boost::addressof(itb->next); + node_pointer* pp = std::addressof(itb->next); while (*pp != pos.p) { - pp = boost::addressof((*pp)->next); + pp = std::addressof((*pp)->next); } buckets_.extract_node_after(itb, pp); @@ -2224,9 +2224,9 @@ namespace boost { // each bucket group so we have to retrieve it manually by iterating // bucket_iterator itb = first.itb; - node_pointer* pp = boost::addressof(itb->next); + node_pointer* pp = std::addressof(itb->next); while (*pp != first.p) { - pp = boost::addressof((*pp)->next); + pp = std::addressof((*pp)->next); } while (*pp != last.p) { @@ -2245,7 +2245,7 @@ namespace boost { } else { ++itb; } - pp = boost::addressof(itb->next); + pp = std::addressof(itb->next); } } @@ -2656,7 +2656,7 @@ namespace boost { for (; itb != last;) { bucket_iterator next_itb = itb; ++next_itb; - node_pointer* pp = boost::addressof(itb->next); + node_pointer* pp = std::addressof(itb->next); while (*pp) { node_pointer p = *pp; buckets_.extract_node_after(itb, pp); diff --git a/include/boost/unordered/detail/serialize_container.hpp b/include/boost/unordered/detail/serialize_container.hpp index 1c037e2b..218c636d 100644 --- a/include/boost/unordered/detail/serialize_container.hpp +++ b/include/boost/unordered/detail/serialize_container.hpp @@ -63,7 +63,7 @@ template struct load_or_save_unordered_set /* save */ ar< struct load_or_save_unordered_set /* load */ x.insert(std::move(value.get()))); if(!p.second)throw_exception(bad_archive_exception()); ar.reset_object_address( - boost::addressof(*p.first),boost::addressof(value.get())); + std::addressof(*p.first),std::addressof(value.get())); serialization_track(ar,p.first); } } @@ -129,10 +129,10 @@ template struct load_or_save_unordered_map /* save */ */ core::save_construct_data_adl( - ar,boost::addressof(first->first),key_version); + ar,std::addressof(first->first),key_version); ar<first); core::save_construct_data_adl( - ar,boost::addressof(first->second),mapped_version); + ar,std::addressof(first->second),mapped_version); ar<second); serialization_track(ar,first); } @@ -169,9 +169,9 @@ template struct load_or_save_unordered_map /* load */ x.emplace(std::move(key.get()),std::move(mapped.get()))); if(!p.second)throw_exception(bad_archive_exception()); ar.reset_object_address( - boost::addressof(p.first->first),boost::addressof(key.get())); + std::addressof(p.first->first),std::addressof(key.get())); ar.reset_object_address( - boost::addressof(p.first->second),boost::addressof(mapped.get())); + std::addressof(p.first->second),std::addressof(mapped.get())); serialization_track(ar,p.first); } } diff --git a/test/cfoa/helpers.hpp b/test/cfoa/helpers.hpp index 307a1d7f..fcdc64ce 100644 --- a/test/cfoa/helpers.hpp +++ b/test/cfoa/helpers.hpp @@ -536,7 +536,7 @@ public: T& operator[](std::ptrdiff_t s) const { return ptr_[s]; } bool operator!() const { return !ptr_; } - static ptr pointer_to(T& p) { return ptr(boost::addressof(p)); } + static ptr pointer_to(T& p) { return ptr(std::addressof(p)); } // I'm not using the safe bool idiom because the containers should be // able to cope with bool conversions. diff --git a/test/objects/minimal.hpp b/test/objects/minimal.hpp index 5f775191..c4b8d831 100644 --- a/test/objects/minimal.hpp +++ b/test/objects/minimal.hpp @@ -339,7 +339,7 @@ namespace test { bool operator!() const { return !ptr_; } static ptr pointer_to(T& p) { - return ptr(boost::addressof(p)); + return ptr(std::addressof(p)); } // I'm not using the safe bool idiom because the containers should be diff --git a/test/unordered/rehash_tests.cpp b/test/unordered/rehash_tests.cpp index 5297893e..831a5c23 100644 --- a/test/unordered/rehash_tests.cpp +++ b/test/unordered/rehash_tests.cpp @@ -451,14 +451,14 @@ namespace rehash_tests { typedef typename X::iterator iterator; for (iterator pos = x.begin(); pos != x.end(); ++pos) { - elements.insert(boost::addressof(*pos)); + elements.insert(std::addressof(*pos)); } x.rehash(2 * x.bucket_count()); for (iterator pos = x.begin(); pos != x.end(); ++pos) { if (!BOOST_TEST( - elements.find(boost::addressof(*pos)) != elements.end())) { + elements.find(std::addressof(*pos)) != elements.end())) { break; } }