[libcxx-commits] [libcxx] 3d74398 - [libc++][spaceship] P1614R2: Removed `operator!=` from `unordered_map`, `unordered_multimap`, `__hash_map_iterator`

Hristo Hristov via libcxx-commits libcxx-commits at lists.llvm.org
Sun Jun 11 23:23:43 PDT 2023


Author: Hristo Hristov
Date: 2023-06-12T09:23:36+03:00
New Revision: 3d74398bd33b60ed00b92cb89fe6fe226ce9e8b1

URL: https://github.com/llvm/llvm-project/commit/3d74398bd33b60ed00b92cb89fe6fe226ce9e8b1
DIFF: https://github.com/llvm/llvm-project/commit/3d74398bd33b60ed00b92cb89fe6fe226ce9e8b1.diff

LOG: [libc++][spaceship] P1614R2: Removed `operator!=` from `unordered_map`, `unordered_multimap`, `__hash_map_iterator`

Implements parts of P1614R2:
- Removed ops from `unordered_map`
- Removed ops from `unordered_multimap`
- Removed ops from `__hash_map_iterator`

Reviewed By: #libc, Mordante

Differential Revision: https://reviews.llvm.org/D152642

Added: 
    

Modified: 
    libcxx/docs/Status/SpaceshipProjects.csv
    libcxx/include/unordered_map

Removed: 
    


################################################################################
diff  --git a/libcxx/docs/Status/SpaceshipProjects.csv b/libcxx/docs/Status/SpaceshipProjects.csv
index d4661068858f1..aff1da905986e 100644
--- a/libcxx/docs/Status/SpaceshipProjects.csv
+++ b/libcxx/docs/Status/SpaceshipProjects.csv
@@ -97,8 +97,8 @@ Section,Description,Dependencies,Assignee,Complete
 | `multimap <https://reviews.llvm.org/D145976>`_",[expos.only.func],Hristo Hristov,|Complete|
 | `[associative.set.syn] <https://wg21.link/associative.set.syn>`_ (`general <https://wg21.link/container.opt.reqmts>`_),"| `multiset <https://reviews.llvm.org/D148416>`_
 | `set <https://reviews.llvm.org/D148416>`_",[expos.only.func],Hristo Hristov,|Complete|
-| `[unord.map.syn] <https://wg21.link/unord.map.syn>`_,"| remove ops `unordered_map`
-| remove ops `unordered_multimap`",None,Unassigned,|Not Started|
+| `[unord.map.syn] <https://wg21.link/unord.map.syn>`_,"| remove ops `unordered_map <https://reviews.llvm.org/D152642>`_
+| remove ops `unordered_multimap <https://reviews.llvm.org/D152642>`_",None,Hristo Hristov,|Complete|
 | `[unordered.set.syn] <https://wg21.link/unordered.set.syn>`_,"| remove ops `unordered_set <https://reviews.llvm.org/D152643>`_
 | remove ops `unordered_multiset <https://reviews.llvm.org/D152643>`_",None,Hristo Hristov,|Complete|
 | `[queue.syn] <https://wg21.link/queue.syn>`_,| `queue <https://reviews.llvm.org/D146066>`_,None,Hristo Hristov,|Complete|

diff  --git a/libcxx/include/unordered_map b/libcxx/include/unordered_map
index 414b7fdc2bb8a..d0168a01065e6 100644
--- a/libcxx/include/unordered_map
+++ b/libcxx/include/unordered_map
@@ -270,7 +270,7 @@ template <class Key, class T, class Hash, class Pred, class Alloc>
 template <class Key, class T, class Hash, class Pred, class Alloc>
     bool
     operator!=(const unordered_map<Key, T, Hash, Pred, Alloc>& x,
-               const unordered_map<Key, T, Hash, Pred, Alloc>& y);
+               const unordered_map<Key, T, Hash, Pred, Alloc>& y); // Removed in C++20
 
 template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>,
           class Alloc = allocator<pair<const Key, T>>>
@@ -508,7 +508,7 @@ template <class Key, class T, class Hash, class Pred, class Alloc>
 template <class Key, class T, class Hash, class Pred, class Alloc>
     bool
     operator!=(const unordered_multimap<Key, T, Hash, Pred, Alloc>& x,
-               const unordered_multimap<Key, T, Hash, Pred, Alloc>& y);
+               const unordered_multimap<Key, T, Hash, Pred, Alloc>& y); // Removed in C++20
 
 }  // std
 
@@ -954,9 +954,11 @@ public:
     friend _LIBCPP_INLINE_VISIBILITY
         bool operator==(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
         {return __x.__i_ == __y.__i_;}
+#if _LIBCPP_STD_VER <= 17
     friend _LIBCPP_INLINE_VISIBILITY
         bool operator!=(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
         {return __x.__i_ != __y.__i_;}
+#endif
 
     template <class, class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS unordered_map;
     template <class, class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS unordered_multimap;
@@ -1008,9 +1010,11 @@ public:
     friend _LIBCPP_INLINE_VISIBILITY
         bool operator==(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
         {return __x.__i_ == __y.__i_;}
+#if _LIBCPP_STD_VER <= 17
     friend _LIBCPP_INLINE_VISIBILITY
         bool operator!=(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
         {return __x.__i_ != __y.__i_;}
+#endif
 
     template <class, class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS unordered_map;
     template <class, class, class, class, class> friend class _LIBCPP_TEMPLATE_VIS unordered_multimap;
@@ -1905,6 +1909,8 @@ operator==(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
     return true;
 }
 
+#if _LIBCPP_STD_VER <= 17
+
 template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
 inline _LIBCPP_INLINE_VISIBILITY
 bool
@@ -1914,6 +1920,8 @@ operator!=(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
     return !(__x == __y);
 }
 
+#endif
+
 template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>,
           class _Alloc = allocator<pair<const _Key, _Tp> > >
 class _LIBCPP_TEMPLATE_VIS unordered_multimap
@@ -2619,6 +2627,8 @@ operator==(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
     return true;
 }
 
+#if _LIBCPP_STD_VER <= 17
+
 template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
 inline _LIBCPP_INLINE_VISIBILITY
 bool
@@ -2628,6 +2638,8 @@ operator!=(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
     return !(__x == __y);
 }
 
+#endif
+
 _LIBCPP_END_NAMESPACE_STD
 
 #if _LIBCPP_STD_VER >= 17


        


More information about the libcxx-commits mailing list