@@ -604,7 +604,9 @@ template <class Key, class T, class Hash, class Pred, class Alloc>
604604#include < __ranges/concepts.h>
605605#include < __ranges/container_compatible_range.h>
606606#include < __ranges/from_range.h>
607+ #include < __type_traits/container_traits.h>
607608#include < __type_traits/enable_if.h>
609+ #include < __type_traits/invoke.h>
608610#include < __type_traits/is_allocator.h>
609611#include < __type_traits/is_integral.h>
610612#include < __type_traits/remove_const.h>
@@ -1830,6 +1832,16 @@ inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const unordered_map<_Key, _Tp, _Has
18301832
18311833#endif
18321834
1835+ template <class _Key , class _Tp , class _Hash , class _Pred , class _Alloc >
1836+ struct __container_traits <unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc> > {
1837+ // http://eel.is/c++draft/unord.req.except#2
1838+ // For unordered associative containers, if an exception is thrown by any operation
1839+ // other than the container's hash function from within an insert or emplace function
1840+ // inserting a single element, the insertion has no effect.
1841+ static _LIBCPP_CONSTEXPR const bool __emplacement_has_strong_exception_safety_guarantee =
1842+ __nothrow_invokable<_Hash, const _Key&>::value;
1843+ };
1844+
18331845template <class _Key ,
18341846 class _Tp ,
18351847 class _Hash = hash<_Key>,
@@ -2520,6 +2532,16 @@ inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const unordered_multimap<_Key, _Tp,
25202532
25212533#endif
25222534
2535+ template <class _Key , class _Tp , class _Hash , class _Pred , class _Alloc >
2536+ struct __container_traits <unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc> > {
2537+ // http://eel.is/c++draft/unord.req.except#2
2538+ // For unordered associative containers, if an exception is thrown by any operation
2539+ // other than the container's hash function from within an insert or emplace function
2540+ // inserting a single element, the insertion has no effect.
2541+ static _LIBCPP_CONSTEXPR const bool __emplacement_has_strong_exception_safety_guarantee =
2542+ __nothrow_invokable<_Hash, const _Key&>::value;
2543+ };
2544+
25232545_LIBCPP_END_NAMESPACE_STD
25242546
25252547#if _LIBCPP_STD_VER >= 17
0 commit comments