diff --git a/libcxx/include/__functional/is_transparent.h b/libcxx/include/__functional/is_transparent.h index c2c6fbce2465b..a62b4cac952c0 100644 --- a/libcxx/include/__functional/is_transparent.h +++ b/libcxx/include/__functional/is_transparent.h @@ -21,11 +21,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD #if _LIBCPP_STD_VER >= 14 -template +template inline const bool __is_transparent_v = false; -template -inline const bool __is_transparent_v<_Tp, _Key, __void_t > = true; +template +inline const bool __is_transparent_v<_Comparator, __void_t > = true; #endif diff --git a/libcxx/include/map b/libcxx/include/map index 27678b710f19e..b7031aeb51c7a 100644 --- a/libcxx/include/map +++ b/libcxx/include/map @@ -1314,14 +1314,14 @@ public: [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __tree_.find(__k); } # if _LIBCPP_STD_VER >= 14 template || __is_transparently_comparable_v<_Compare, key_type, _K2>, - int> = 0> + class _Comp = _Compare, + enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) { return __tree_.find(__k); } template || __is_transparently_comparable_v<_Compare, key_type, _K2>, - int> = 0> + class _Comp = _Compare, + enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const { return __tree_.find(__k); } @@ -1331,7 +1331,7 @@ public: return __tree_.__count_unique(__k); } # if _LIBCPP_STD_VER >= 14 - template , int> = 0> + template , int> = 0> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const { return __tree_.__count_multi(__k); } @@ -1340,8 +1340,8 @@ public: # if _LIBCPP_STD_VER >= 20 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); } template || __is_transparently_comparable_v<_Compare, key_type, _K2>, - int> = 0> + class _Comp = _Compare, + enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const { return find(__k) != end(); } @@ -1359,15 +1359,15 @@ public: // match multiple elements. # if _LIBCPP_STD_VER >= 14 template || __is_transparently_comparable_v<_Compare, key_type, _K2>, - int> = 0> + class _Comp = _Compare, + enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const _K2& __k) { return __tree_.__lower_bound_multi(__k); } template || __is_transparently_comparable_v<_Compare, key_type, _K2>, - int> = 0> + class _Comp = _Compare, + enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const _K2& __k) const { return __tree_.__lower_bound_multi(__k); } @@ -1383,14 +1383,14 @@ public: # if _LIBCPP_STD_VER >= 14 template || __is_transparently_comparable_v<_Compare, key_type, _K2>, - int> = 0> + class _Comp = _Compare, + enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const _K2& __k) { return __tree_.__upper_bound_multi(__k); } template || __is_transparently_comparable_v<_Compare, key_type, _K2>, - int> = 0> + class _Comp = _Compare, + enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const _K2& __k) const { return __tree_.__upper_bound_multi(__k); } @@ -1403,11 +1403,11 @@ public: return __tree_.__equal_range_unique(__k); } # if _LIBCPP_STD_VER >= 14 - template , int> = 0> + template , int> = 0> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair equal_range(const _K2& __k) { return __tree_.__equal_range_multi(__k); } - template , int> = 0> + template , int> = 0> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair equal_range(const _K2& __k) const { return __tree_.__equal_range_multi(__k); } @@ -1917,11 +1917,11 @@ public: [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __tree_.find(__k); } [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __tree_.find(__k); } # if _LIBCPP_STD_VER >= 14 - template , int> = 0> + template , int> = 0> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) { return __tree_.find(__k); } - template , int> = 0> + template , int> = 0> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const { return __tree_.find(__k); } @@ -1931,7 +1931,7 @@ public: return __tree_.__count_multi(__k); } # if _LIBCPP_STD_VER >= 14 - template , int> = 0> + template , int> = 0> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const { return __tree_.__count_multi(__k); } @@ -1939,7 +1939,7 @@ public: # if _LIBCPP_STD_VER >= 20 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); } - template , int> = 0> + template , int> = 0> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const { return find(__k) != end(); } @@ -1954,12 +1954,12 @@ public: } # if _LIBCPP_STD_VER >= 14 - template , int> = 0> + template , int> = 0> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const _K2& __k) { return __tree_.__lower_bound_multi(__k); } - template , int> = 0> + template , int> = 0> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const _K2& __k) const { return __tree_.__lower_bound_multi(__k); } @@ -1974,11 +1974,11 @@ public: } # if _LIBCPP_STD_VER >= 14 - template , int> = 0> + template , int> = 0> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const _K2& __k) { return __tree_.__upper_bound_multi(__k); } - template , int> = 0> + template , int> = 0> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const _K2& __k) const { return __tree_.__upper_bound_multi(__k); } @@ -1991,11 +1991,11 @@ public: return __tree_.__equal_range_multi(__k); } # if _LIBCPP_STD_VER >= 14 - template , int> = 0> + template , int> = 0> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair equal_range(const _K2& __k) { return __tree_.__equal_range_multi(__k); } - template , int> = 0> + template , int> = 0> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair equal_range(const _K2& __k) const { return __tree_.__equal_range_multi(__k); } diff --git a/libcxx/include/set b/libcxx/include/set index 265c2f6cb6501..695b6c87e3984 100644 --- a/libcxx/include/set +++ b/libcxx/include/set @@ -825,11 +825,11 @@ public: [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __tree_.find(__k); } [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __tree_.find(__k); } # if _LIBCPP_STD_VER >= 14 - template , int> = 0> + template , int> = 0> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) { return __tree_.find(__k); } - template , int> = 0> + template , int> = 0> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const { return __tree_.find(__k); } @@ -839,7 +839,7 @@ public: return __tree_.__count_unique(__k); } # if _LIBCPP_STD_VER >= 14 - template , int> = 0> + template , int> = 0> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const { return __tree_.__count_multi(__k); } @@ -847,7 +847,7 @@ public: # if _LIBCPP_STD_VER >= 20 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); } - template , int> = 0> + template , int> = 0> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const { return find(__k) != end(); } @@ -864,12 +864,12 @@ public: // The transparent versions of the lookup functions use the _multi version, since a non-element key is allowed to // match multiple elements. # if _LIBCPP_STD_VER >= 14 - template , int> = 0> + template , int> = 0> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const _K2& __k) { return __tree_.__lower_bound_multi(__k); } - template , int> = 0> + template , int> = 0> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const _K2& __k) const { return __tree_.__lower_bound_multi(__k); } @@ -884,11 +884,11 @@ public: } # if _LIBCPP_STD_VER >= 14 - template , int> = 0> + template , int> = 0> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const _K2& __k) { return __tree_.__upper_bound_multi(__k); } - template , int> = 0> + template , int> = 0> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const _K2& __k) const { return __tree_.__upper_bound_multi(__k); } @@ -901,11 +901,11 @@ public: return __tree_.__equal_range_unique(__k); } # if _LIBCPP_STD_VER >= 14 - template , int> = 0> + template , int> = 0> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair equal_range(const _K2& __k) { return __tree_.__equal_range_multi(__k); } - template , int> = 0> + template , int> = 0> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair equal_range(const _K2& __k) const { return __tree_.__equal_range_multi(__k); } @@ -1302,11 +1302,11 @@ public: [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __tree_.find(__k); } [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __tree_.find(__k); } # if _LIBCPP_STD_VER >= 14 - template , int> = 0> + template , int> = 0> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) { return __tree_.find(__k); } - template , int> = 0> + template , int> = 0> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const { return __tree_.find(__k); } @@ -1316,7 +1316,7 @@ public: return __tree_.__count_multi(__k); } # if _LIBCPP_STD_VER >= 14 - template , int> = 0> + template , int> = 0> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const { return __tree_.__count_multi(__k); } @@ -1324,7 +1324,7 @@ public: # if _LIBCPP_STD_VER >= 20 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); } - template , int> = 0> + template , int> = 0> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const { return find(__k) != end(); } @@ -1339,12 +1339,12 @@ public: } # if _LIBCPP_STD_VER >= 14 - template , int> = 0> + template , int> = 0> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const _K2& __k) { return __tree_.__lower_bound_multi(__k); } - template , int> = 0> + template , int> = 0> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const _K2& __k) const { return __tree_.__lower_bound_multi(__k); } @@ -1359,11 +1359,11 @@ public: } # if _LIBCPP_STD_VER >= 14 - template , int> = 0> + template , int> = 0> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const _K2& __k) { return __tree_.__upper_bound_multi(__k); } - template , int> = 0> + template , int> = 0> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const _K2& __k) const { return __tree_.__upper_bound_multi(__k); } @@ -1376,11 +1376,11 @@ public: return __tree_.__equal_range_multi(__k); } # if _LIBCPP_STD_VER >= 14 - template , int> = 0> + template , int> = 0> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair equal_range(const _K2& __k) { return __tree_.__equal_range_multi(__k); } - template , int> = 0> + template , int> = 0> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair equal_range(const _K2& __k) const { return __tree_.__equal_range_multi(__k); } diff --git a/libcxx/include/unordered_map b/libcxx/include/unordered_map index ca53348eb5e2a..6afa5c39029f4 100644 --- a/libcxx/include/unordered_map +++ b/libcxx/include/unordered_map @@ -1216,11 +1216,17 @@ public: [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __table_.find(__k); } [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __table_.find(__k); } # if _LIBCPP_STD_VER >= 20 - template && __is_transparent_v>* = nullptr> + template && __is_transparent_v<_Comp>>* = nullptr> [[nodiscard]] _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) { return __table_.find(__k); } - template && __is_transparent_v>* = nullptr> + template && __is_transparent_v<_Comp>>* = nullptr> [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const { return __table_.find(__k); } @@ -1230,7 +1236,10 @@ public: return __table_.__count_unique(__k); } # if _LIBCPP_STD_VER >= 20 - template && __is_transparent_v>* = nullptr> + template && __is_transparent_v<_Comp>>* = nullptr> [[nodiscard]] _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const { return __table_.__count_unique(__k); } @@ -1239,7 +1248,10 @@ public: # if _LIBCPP_STD_VER >= 20 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); } - template && __is_transparent_v>* = nullptr> + template && __is_transparent_v<_Comp>>* = nullptr> [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const { return find(__k) != end(); } @@ -1252,11 +1264,17 @@ public: return __table_.__equal_range_unique(__k); } # if _LIBCPP_STD_VER >= 20 - template && __is_transparent_v>* = nullptr> + template && __is_transparent_v<_Comp>>* = nullptr> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair equal_range(const _K2& __k) { return __table_.__equal_range_unique(__k); } - template && __is_transparent_v>* = nullptr> + template && __is_transparent_v<_Comp>>* = nullptr> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair equal_range(const _K2& __k) const { return __table_.__equal_range_unique(__k); } @@ -1936,11 +1954,17 @@ public: [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __table_.find(__k); } [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __table_.find(__k); } # if _LIBCPP_STD_VER >= 20 - template && __is_transparent_v>* = nullptr> + template && __is_transparent_v<_Comp>>* = nullptr> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) { return __table_.find(__k); } - template && __is_transparent_v>* = nullptr> + template && __is_transparent_v<_Comp>>* = nullptr> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const { return __table_.find(__k); } @@ -1950,7 +1974,10 @@ public: return __table_.__count_multi(__k); } # if _LIBCPP_STD_VER >= 20 - template && __is_transparent_v>* = nullptr> + template && __is_transparent_v<_Comp>>* = nullptr> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const { return __table_.__count_multi(__k); } @@ -1959,7 +1986,10 @@ public: # if _LIBCPP_STD_VER >= 20 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); } - template && __is_transparent_v>* = nullptr> + template && __is_transparent_v<_Comp>>* = nullptr> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const { return find(__k) != end(); } @@ -1972,11 +2002,17 @@ public: return __table_.__equal_range_multi(__k); } # if _LIBCPP_STD_VER >= 20 - template && __is_transparent_v>* = nullptr> + template && __is_transparent_v<_Comp>>* = nullptr> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair equal_range(const _K2& __k) { return __table_.__equal_range_multi(__k); } - template && __is_transparent_v>* = nullptr> + template && __is_transparent_v<_Comp>>* = nullptr> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair equal_range(const _K2& __k) const { return __table_.__equal_range_multi(__k); } diff --git a/libcxx/include/unordered_set b/libcxx/include/unordered_set index 760f145091895..45a36f34973a5 100644 --- a/libcxx/include/unordered_set +++ b/libcxx/include/unordered_set @@ -844,11 +844,17 @@ public: [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __table_.find(__k); } [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __table_.find(__k); } # if _LIBCPP_STD_VER >= 20 - template && __is_transparent_v>* = nullptr> + template && __is_transparent_v<_Comp>>* = nullptr> [[nodiscard]] _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) { return __table_.find(__k); } - template && __is_transparent_v>* = nullptr> + template && __is_transparent_v<_Comp>>* = nullptr> [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const { return __table_.find(__k); } @@ -858,7 +864,10 @@ public: return __table_.__count_unique(__k); } # if _LIBCPP_STD_VER >= 20 - template && __is_transparent_v>* = nullptr> + template && __is_transparent_v<_Comp>>* = nullptr> [[nodiscard]] _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const { return __table_.__count_unique(__k); } @@ -867,7 +876,10 @@ public: # if _LIBCPP_STD_VER >= 20 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); } - template && __is_transparent_v>* = nullptr> + template && __is_transparent_v<_Comp>>* = nullptr> [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const { return find(__k) != end(); } @@ -880,11 +892,17 @@ public: return __table_.__equal_range_unique(__k); } # if _LIBCPP_STD_VER >= 20 - template && __is_transparent_v>* = nullptr> + template && __is_transparent_v<_Comp>>* = nullptr> [[nodiscard]] _LIBCPP_HIDE_FROM_ABI pair equal_range(const _K2& __k) { return __table_.__equal_range_unique(__k); } - template && __is_transparent_v>* = nullptr> + template && __is_transparent_v<_Comp>>* = nullptr> [[nodiscard]] _LIBCPP_HIDE_FROM_ABI pair equal_range(const _K2& __k) const { return __table_.__equal_range_unique(__k); } @@ -1443,11 +1461,17 @@ public: [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __table_.find(__k); } [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __table_.find(__k); } # if _LIBCPP_STD_VER >= 20 - template && __is_transparent_v>* = nullptr> + template && __is_transparent_v<_Comp>>* = nullptr> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) { return __table_.find(__k); } - template && __is_transparent_v>* = nullptr> + template && __is_transparent_v<_Comp>>* = nullptr> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const { return __table_.find(__k); } @@ -1457,7 +1481,10 @@ public: return __table_.__count_multi(__k); } # if _LIBCPP_STD_VER >= 20 - template && __is_transparent_v>* = nullptr> + template && __is_transparent_v<_Comp>>* = nullptr> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const { return __table_.__count_multi(__k); } @@ -1466,7 +1493,10 @@ public: # if _LIBCPP_STD_VER >= 20 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); } - template && __is_transparent_v>* = nullptr> + template && __is_transparent_v<_Comp>>* = nullptr> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const { return find(__k) != end(); } @@ -1479,11 +1509,17 @@ public: return __table_.__equal_range_multi(__k); } # if _LIBCPP_STD_VER >= 20 - template && __is_transparent_v>* = nullptr> + template && __is_transparent_v<_Comp>>* = nullptr> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair equal_range(const _K2& __k) { return __table_.__equal_range_multi(__k); } - template && __is_transparent_v>* = nullptr> + template && __is_transparent_v<_Comp>>* = nullptr> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair equal_range(const _K2& __k) const { return __table_.__equal_range_multi(__k); }