@@ -600,7 +600,10 @@ erase_if(multimap<Key, T, Compare, Allocator>& c, Predicate pred); // C++20
600600# include < __ranges/from_range.h>
601601# include < __tree>
602602# include < __type_traits/container_traits.h>
603+ # include < __type_traits/desugars_to.h>
603604# include < __type_traits/is_allocator.h>
605+ # include < __type_traits/is_convertible.h>
606+ # include < __type_traits/make_transparent.h>
604607# include < __type_traits/remove_const.h>
605608# include < __type_traits/type_identity.h>
606609# include < __utility/forward.h>
@@ -666,6 +669,11 @@ public:
666669# endif
667670};
668671
672+ template <class _Key , class _MapValueT , class _Compare >
673+ struct __make_transparent <__map_value_compare<_Key, _MapValueT, _Compare> > {
674+ using type _LIBCPP_NODEBUG = __map_value_compare<_Key, _MapValueT, __make_transparent_t <_Compare> >;
675+ };
676+
669677# if _LIBCPP_STD_VER >= 14
670678template <class _MapValueT , class _Key , class _Compare >
671679struct __lazy_synth_three_way_comparator <__map_value_compare<_Key, _MapValueT, _Compare>, _MapValueT, _MapValueT> {
@@ -1048,6 +1056,24 @@ public:
10481056 _LIBCPP_HIDE_FROM_ABI mapped_type& operator [](key_type&& __k);
10491057# endif
10501058
1059+ template <class _Arg ,
1060+ __enable_if_t <__is_transparently_comparable_v<_Compare, key_type, __remove_cvref_t <_Arg> >, int > = 0 >
1061+ _LIBCPP_HIDE_FROM_ABI mapped_type& at (_Arg&& __arg) {
1062+ auto [_, __child] = __tree_.__find_equal (__arg);
1063+ if (__child == nullptr )
1064+ std::__throw_out_of_range (" map::at: key not found" );
1065+ return static_cast <__node_pointer>(__child)->__get_value ().second ;
1066+ }
1067+
1068+ template <class _Arg ,
1069+ __enable_if_t <__is_transparently_comparable_v<_Compare, key_type, __remove_cvref_t <_Arg> >, int > = 0 >
1070+ _LIBCPP_HIDE_FROM_ABI const mapped_type& at (_Arg&& __arg) const {
1071+ auto [_, __child] = __tree_.__find_equal (__arg);
1072+ if (__child == nullptr )
1073+ std::__throw_out_of_range (" map::at: key not found" );
1074+ return static_cast <__node_pointer>(__child)->__get_value ().second ;
1075+ }
1076+
10511077 _LIBCPP_HIDE_FROM_ABI mapped_type& at (const key_type& __k);
10521078 _LIBCPP_HIDE_FROM_ABI const mapped_type& at (const key_type& __k) const ;
10531079
@@ -1242,11 +1268,15 @@ public:
12421268 _LIBCPP_HIDE_FROM_ABI iterator find (const key_type& __k) { return __tree_.find (__k); }
12431269 _LIBCPP_HIDE_FROM_ABI const_iterator find (const key_type& __k) const { return __tree_.find (__k); }
12441270# if _LIBCPP_STD_VER >= 14
1245- template <typename _K2, enable_if_t <__is_transparent_v<_Compare, _K2>, int > = 0 >
1271+ template <typename _K2,
1272+ enable_if_t <__is_transparent_v<_Compare, _K2> || __is_transparently_comparable_v<_Compare, key_type, _K2>,
1273+ int > = 0 >
12461274 _LIBCPP_HIDE_FROM_ABI iterator find (const _K2& __k) {
12471275 return __tree_.find (__k);
12481276 }
1249- template <typename _K2, enable_if_t <__is_transparent_v<_Compare, _K2>, int > = 0 >
1277+ template <typename _K2,
1278+ enable_if_t <__is_transparent_v<_Compare, _K2> || __is_transparently_comparable_v<_Compare, key_type, _K2>,
1279+ int > = 0 >
12501280 _LIBCPP_HIDE_FROM_ABI const_iterator find (const _K2& __k) const {
12511281 return __tree_.find (__k);
12521282 }
@@ -1262,7 +1292,9 @@ public:
12621292
12631293# if _LIBCPP_STD_VER >= 20
12641294 _LIBCPP_HIDE_FROM_ABI bool contains (const key_type& __k) const { return find (__k) != end (); }
1265- template <typename _K2, enable_if_t <__is_transparent_v<_Compare, _K2>, int > = 0 >
1295+ template <typename _K2,
1296+ enable_if_t <__is_transparent_v<_Compare, _K2> || __is_transparently_comparable_v<_Compare, key_type, _K2>,
1297+ int > = 0 >
12661298 _LIBCPP_HIDE_FROM_ABI bool contains (const _K2& __k) const {
12671299 return find (__k) != end ();
12681300 }
@@ -1271,12 +1303,16 @@ public:
12711303 _LIBCPP_HIDE_FROM_ABI iterator lower_bound (const key_type& __k) { return __tree_.lower_bound (__k); }
12721304 _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound (const key_type& __k) const { return __tree_.lower_bound (__k); }
12731305# if _LIBCPP_STD_VER >= 14
1274- template <typename _K2, enable_if_t <__is_transparent_v<_Compare, _K2>, int > = 0 >
1306+ template <typename _K2,
1307+ enable_if_t <__is_transparent_v<_Compare, _K2> || __is_transparently_comparable_v<_Compare, key_type, _K2>,
1308+ int > = 0 >
12751309 _LIBCPP_HIDE_FROM_ABI iterator lower_bound (const _K2& __k) {
12761310 return __tree_.lower_bound (__k);
12771311 }
12781312
1279- template <typename _K2, enable_if_t <__is_transparent_v<_Compare, _K2>, int > = 0 >
1313+ template <typename _K2,
1314+ enable_if_t <__is_transparent_v<_Compare, _K2> || __is_transparently_comparable_v<_Compare, key_type, _K2>,
1315+ int > = 0 >
12801316 _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound (const _K2& __k) const {
12811317 return __tree_.lower_bound (__k);
12821318 }
@@ -1285,11 +1321,15 @@ public:
12851321 _LIBCPP_HIDE_FROM_ABI iterator upper_bound (const key_type& __k) { return __tree_.upper_bound (__k); }
12861322 _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound (const key_type& __k) const { return __tree_.upper_bound (__k); }
12871323# if _LIBCPP_STD_VER >= 14
1288- template <typename _K2, enable_if_t <__is_transparent_v<_Compare, _K2>, int > = 0 >
1324+ template <typename _K2,
1325+ enable_if_t <__is_transparent_v<_Compare, _K2> || __is_transparently_comparable_v<_Compare, key_type, _K2>,
1326+ int > = 0 >
12891327 _LIBCPP_HIDE_FROM_ABI iterator upper_bound (const _K2& __k) {
12901328 return __tree_.upper_bound (__k);
12911329 }
1292- template <typename _K2, enable_if_t <__is_transparent_v<_Compare, _K2>, int > = 0 >
1330+ template <typename _K2,
1331+ enable_if_t <__is_transparent_v<_Compare, _K2> || __is_transparently_comparable_v<_Compare, key_type, _K2>,
1332+ int > = 0 >
12931333 _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound (const _K2& __k) const {
12941334 return __tree_.upper_bound (__k);
12951335 }
0 commit comments