From d615a08f76fae442984009d45389e959065829b9 Mon Sep 17 00:00:00 2001 From: joaquintides Date: Fri, 12 May 2023 12:33:27 +0200 Subject: [PATCH] made operator [==|!=] templated again to accommodate fwd declarations --- .../boost/unordered/concurrent_flat_map.hpp | 36 +++++++++++-------- .../boost/unordered/unordered_flat_map.hpp | 36 +++++++++++-------- .../boost/unordered/unordered_flat_set.hpp | 36 +++++++++++-------- .../boost/unordered/unordered_node_map.hpp | 36 +++++++++++-------- .../boost/unordered/unordered_node_set.hpp | 36 +++++++++++-------- 5 files changed, 105 insertions(+), 75 deletions(-) diff --git a/include/boost/unordered/concurrent_flat_map.hpp b/include/boost/unordered/concurrent_flat_map.hpp index d17942cf..4d5d6d64 100644 --- a/include/boost/unordered/concurrent_flat_map.hpp +++ b/include/boost/unordered/concurrent_flat_map.hpp @@ -148,6 +148,11 @@ namespace boost { detail::foa::concurrent_table table_; + template + bool friend operator==( + concurrent_flat_map const& lhs, + concurrent_flat_map const& rhs); + public: using key_type = Key; using mapped_type = T; @@ -766,22 +771,23 @@ namespace boost { hasher hash_function() const { return table_.hash_function(); } key_equal key_eq() const { return table_.key_eq(); } - - /// Equality - /// - - friend bool operator==( - concurrent_flat_map const& lhs, concurrent_flat_map const& rhs) - { - return lhs.table_ == rhs.table_; - } - - friend bool operator!=( - concurrent_flat_map const& lhs, concurrent_flat_map const& rhs) - { - return !(lhs == rhs); - } }; + + template + bool operator==( + concurrent_flat_map const& lhs, + concurrent_flat_map const& rhs) + { + return lhs.table_ == rhs.table_; + } + + template + bool operator!=( + concurrent_flat_map const& lhs, + concurrent_flat_map const& rhs) + { + return !(lhs == rhs); + } } // namespace unordered } // namespace boost diff --git a/include/boost/unordered/unordered_flat_map.hpp b/include/boost/unordered/unordered_flat_map.hpp index 633f466b..23a13438 100644 --- a/include/boost/unordered/unordered_flat_map.hpp +++ b/include/boost/unordered/unordered_flat_map.hpp @@ -100,6 +100,11 @@ namespace boost { table_type table_; + template + bool friend operator==( + unordered_flat_map const& lhs, + unordered_flat_map const& rhs); + template typename unordered_flat_map::size_type friend erase_if( unordered_flat_map& set, Pred pred); @@ -695,23 +700,24 @@ namespace boost { hasher hash_function() const { return table_.hash_function(); } key_equal key_eq() const { return table_.key_eq(); } - - /// Equality - /// - - friend bool operator==( - unordered_flat_map const& lhs, unordered_flat_map const& rhs) - { - return lhs.table_ == rhs.table_; - } - - friend bool operator!=( - unordered_flat_map const& lhs, unordered_flat_map const& rhs) - { - return !(lhs == rhs); - } }; + template + bool operator==( + unordered_flat_map const& lhs, + unordered_flat_map const& rhs) + { + return lhs.table_ == rhs.table_; + } + + template + bool operator!=( + unordered_flat_map const& lhs, + unordered_flat_map const& rhs) + { + return !(lhs == rhs); + } + template void swap(unordered_flat_map& lhs, unordered_flat_map& rhs) diff --git a/include/boost/unordered/unordered_flat_set.hpp b/include/boost/unordered/unordered_flat_set.hpp index eb0aa728..d81e1082 100644 --- a/include/boost/unordered/unordered_flat_set.hpp +++ b/include/boost/unordered/unordered_flat_set.hpp @@ -69,6 +69,11 @@ namespace boost { table_type table_; + template + bool friend operator==( + unordered_flat_set const& lhs, + unordered_flat_set const& rhs); + template typename unordered_flat_set::size_type friend erase_if( unordered_flat_set& set, Pred pred); @@ -492,23 +497,24 @@ namespace boost { hasher hash_function() const { return table_.hash_function(); } key_equal key_eq() const { return table_.key_eq(); } - - /// Equality - /// - - friend bool operator==( - unordered_flat_set const& lhs, unordered_flat_set const& rhs) - { - return lhs.table_ == rhs.table_; - } - - friend bool operator!=( - unordered_flat_set const& lhs, unordered_flat_set const& rhs) - { - return !(lhs == rhs); - } }; + template + bool operator==( + unordered_flat_set const& lhs, + unordered_flat_set const& rhs) + { + return lhs.table_ == rhs.table_; + } + + template + bool operator!=( + unordered_flat_set const& lhs, + unordered_flat_set const& rhs) + { + return !(lhs == rhs); + } + template void swap(unordered_flat_set& lhs, unordered_flat_set& rhs) diff --git a/include/boost/unordered/unordered_node_map.hpp b/include/boost/unordered/unordered_node_map.hpp index 910996c5..8d32ba0a 100644 --- a/include/boost/unordered/unordered_node_map.hpp +++ b/include/boost/unordered/unordered_node_map.hpp @@ -187,6 +187,11 @@ namespace boost { table_type table_; + template + bool friend operator==( + unordered_node_map const& lhs, + unordered_node_map const& rhs); + template typename unordered_node_map::size_type friend erase_if( unordered_node_map& set, Pred pred); @@ -847,23 +852,24 @@ namespace boost { hasher hash_function() const { return table_.hash_function(); } key_equal key_eq() const { return table_.key_eq(); } - - /// Equality - /// - - friend bool operator==( - unordered_node_map const& lhs, unordered_node_map const& rhs) - { - return lhs.table_ == rhs.table_; - } - - friend bool operator!=( - unordered_node_map const& lhs, unordered_node_map const& rhs) - { - return !(lhs == rhs); - } }; + template + bool operator==( + unordered_node_map const& lhs, + unordered_node_map const& rhs) + { + return lhs.table_ == rhs.table_; + } + + template + bool operator!=( + unordered_node_map const& lhs, + unordered_node_map const& rhs) + { + return !(lhs == rhs); + } + template void swap(unordered_node_map& lhs, unordered_node_map& rhs) diff --git a/include/boost/unordered/unordered_node_set.hpp b/include/boost/unordered/unordered_node_set.hpp index f9f3762d..87d8677f 100644 --- a/include/boost/unordered/unordered_node_set.hpp +++ b/include/boost/unordered/unordered_node_set.hpp @@ -143,6 +143,11 @@ namespace boost { table_type table_; + template + bool friend operator==( + unordered_node_set const& lhs, + unordered_node_set const& rhs); + template typename unordered_node_set::size_type friend erase_if( unordered_node_set& set, Pred pred); @@ -631,23 +636,24 @@ namespace boost { hasher hash_function() const { return table_.hash_function(); } key_equal key_eq() const { return table_.key_eq(); } - - /// Equality - /// - - friend bool operator==( - unordered_node_set const& lhs, unordered_node_set const& rhs) - { - return lhs.table_ == rhs.table_; - } - - friend bool operator!=( - unordered_node_set const& lhs, unordered_node_set const& rhs) - { - return !(lhs == rhs); - } }; + template + bool operator==( + unordered_node_set const& lhs, + unordered_node_set const& rhs) + { + return lhs.table_ == rhs.table_; + } + + template + bool operator!=( + unordered_node_set const& lhs, + unordered_node_set const& rhs) + { + return !(lhs == rhs); + } + template void swap(unordered_node_set& lhs, unordered_node_set& rhs)