diff --git a/stl/inc/xhash b/stl/inc/xhash index 71460bb5e27..358f5ac4504 100644 --- a/stl/inc/xhash +++ b/stl/inc/xhash @@ -108,12 +108,15 @@ struct _Uhash_choose_transparency { #if _HAS_CXX20 template struct _Uhash_choose_transparency<_Kty, _Hasher, _Keyeq, - void_t> { + enable_if_t, _Is_transparent<_Keyeq>>>> { // transparency selector for transparent hashed containers template using _Deduce_key = const _Keyty&; - using _Transparent = void; + template + static constexpr bool _Supports_transparency = + !disjunction_v, + is_convertible<_Kx, typename _Container::iterator>>; }; #endif // _HAS_CXX20 @@ -1140,8 +1143,8 @@ public: } #if _HAS_CXX23 - template , is_convertible<_Kx, iterator>>, int> = 0> + template , int> = 0> size_type erase(_Kx&& _Keyval) noexcept(noexcept(_Erase(_Keyval))) /* strengthened */ { return _Erase(_Keyval); } @@ -1380,8 +1383,8 @@ public: } #if _HAS_CXX23 - template , is_convertible<_Kx, iterator>>, int> = 0> + template , int> = 0> node_type extract(_Kx&& _Keyval) { const auto _Ptr = _Extract(_Keyval); if (!_Ptr) { diff --git a/stl/inc/xmemory b/stl/inc/xmemory index e569a652bb4..1747cc0a701 100644 --- a/stl/inc/xmemory +++ b/stl/inc/xmemory @@ -2567,6 +2567,20 @@ _EXPORT_STD inline void* align(size_t _Bound, size_t _Size, void*& _Ptr, size_t& _Space -= _Off; return _Ptr; } + +template +_INLINE_VAR constexpr bool _Is_transparent_v = false; + +template +_INLINE_VAR constexpr bool _Is_transparent_v<_Ty, void_t> = true; + +template +struct _Is_transparent : bool_constant<_Is_transparent_v<_Ty>> {}; + +#ifdef __cpp_lib_concepts // TRANSITION, GH-395 +template +concept _Transparent = _Is_transparent_v<_Ty>; +#endif // __cpp_lib_concepts _STD_END #pragma pop_macro("new") diff --git a/stl/inc/xtree b/stl/inc/xtree index 639185e6395..167e168acd7 100644 --- a/stl/inc/xtree +++ b/stl/inc/xtree @@ -1344,8 +1344,10 @@ public: } #if _HAS_CXX23 - template , is_convertible<_Kx, iterator>>, int> = 0> + template , + negation, is_convertible<_Kx, iterator>>>>, + int> = 0> size_type erase(_Kx&& _Keyval) noexcept(noexcept(_Eqrange(_Keyval))) /* strengthened */ { return _Erase(_Eqrange(_Keyval)); } @@ -1382,12 +1384,12 @@ public: return const_iterator(_Find(_Keyval), _Get_scary()); } - template + template , int> = 0> _NODISCARD iterator find(const _Other& _Keyval) { return iterator(_Find(_Keyval), _Get_scary()); } - template + template , int> = 0> _NODISCARD const_iterator find(const _Other& _Keyval) const { return const_iterator(_Find(_Keyval), _Get_scary()); } @@ -1397,7 +1399,7 @@ public: return _Lower_bound_duplicate(_Find_lower_bound(_Keyval)._Bound, _Keyval); } - template + template , int> = 0> _NODISCARD bool contains(const _Other& _Keyval) const { return _Lower_bound_duplicate(_Find_lower_bound(_Keyval)._Bound, _Keyval); } @@ -1413,7 +1415,7 @@ public: } } - template + template , int> = 0> _NODISCARD size_type count(const _Other& _Keyval) const { const auto _Ans = _Eqrange(_Keyval); return static_cast(_STD distance( @@ -1428,12 +1430,12 @@ public: return const_iterator(_Find_lower_bound(_Keyval)._Bound, _Get_scary()); } - template + template , int> = 0> _NODISCARD iterator lower_bound(const _Other& _Keyval) { return iterator(_Find_lower_bound(_Keyval)._Bound, _Get_scary()); } - template + template , int> = 0> _NODISCARD const_iterator lower_bound(const _Other& _Keyval) const { return const_iterator(_Find_lower_bound(_Keyval)._Bound, _Get_scary()); } @@ -1446,12 +1448,12 @@ public: return const_iterator(_Find_upper_bound(_Keyval)._Bound, _Get_scary()); } - template + template , int> = 0> _NODISCARD iterator upper_bound(const _Other& _Keyval) { return iterator(_Find_upper_bound(_Keyval)._Bound, _Get_scary()); } - template + template , int> = 0> _NODISCARD const_iterator upper_bound(const _Other& _Keyval) const { return const_iterator(_Find_upper_bound(_Keyval)._Bound, _Get_scary()); } @@ -1468,14 +1470,14 @@ public: return {const_iterator(_Result.first, _Scary), const_iterator(_Result.second, _Scary)}; } - template + template , int> = 0> _NODISCARD pair equal_range(const _Other& _Keyval) { const auto _Result = _Eqrange(_Keyval); const auto _Scary = _Get_scary(); return {iterator(_Result.first, _Scary), iterator(_Result.second, _Scary)}; } - template + template , int> = 0> _NODISCARD pair equal_range(const _Other& _Keyval) const { const auto _Result = _Eqrange(_Keyval); const auto _Scary = _Get_scary(); @@ -1750,8 +1752,10 @@ public: } #if _HAS_CXX23 - template , is_convertible<_Kx, iterator>>, int> = 0> + template , + negation, is_convertible<_Kx, iterator>>>>, + int> = 0> node_type extract(_Kx&& _Keyval) { const const_iterator _Where = find(_Keyval); if (_Where == end()) {