diff --git a/libcxx/docs/FeatureTestMacroTable.rst b/libcxx/docs/FeatureTestMacroTable.rst --- a/libcxx/docs/FeatureTestMacroTable.rst +++ b/libcxx/docs/FeatureTestMacroTable.rst @@ -206,7 +206,7 @@ ------------------------------------------------- ----------------- ``__cpp_lib_erase_if`` ``202002L`` ------------------------------------------------- ----------------- - ``__cpp_lib_generic_unordered_lookup`` *unimplemented* + ``__cpp_lib_generic_unordered_lookup`` ``201811L`` ------------------------------------------------- ----------------- ``__cpp_lib_interpolate`` ``201902L`` ------------------------------------------------- ----------------- diff --git a/libcxx/include/unordered_map b/libcxx/include/unordered_map --- a/libcxx/include/unordered_map +++ b/libcxx/include/unordered_map @@ -173,10 +173,22 @@ iterator find(const key_type& k); const_iterator find(const key_type& k) const; + template + iterator find(const K& x); // C++20 + template + const_iterator find(const K& x) const; // C++20 size_type count(const key_type& k) const; + template + size_type count(const K& k) const; // C++20 bool contains(const key_type& k) const; // C++20 + template + bool contains(const K& k) const; // C++20 pair equal_range(const key_type& k); pair equal_range(const key_type& k) const; + template + pair equal_range(const K& k); // C++20 + template + pair equal_range(const K& k) const; // C++20 mapped_type& operator[](const key_type& k); mapped_type& operator[](key_type&& k); @@ -355,10 +367,22 @@ iterator find(const key_type& k); const_iterator find(const key_type& k) const; + template + iterator find(const K& x); // C++20 + template + const_iterator find(const K& x) const; // C++20 size_type count(const key_type& k) const; + template + size_type count(const K& k) const; // C++20 bool contains(const key_type& k) const; // C++20 + template + bool contains(const K& k) const; // C++20 pair equal_range(const key_type& k); pair equal_range(const key_type& k) const; + template + pair equal_range(const K& k); // C++20 + template + pair equal_range(const K& k) const; // C++20 size_type bucket_count() const noexcept; size_type max_bucket_count() const noexcept; @@ -423,7 +447,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -template ::value && !__libcpp_is_final<_Hash>::value> class __unordered_map_hasher : private _Hash @@ -445,6 +469,12 @@ _LIBCPP_INLINE_VISIBILITY size_t operator()(const _Key& __x) const {return static_cast(*this)(__x);} +#if _LIBCPP_STD_VER > 17 + template ::value && __is_transparent<_Pred, _K2>::value>> + _LIBCPP_INLINE_VISIBILITY + size_t operator()(const _K2& __x) const + {return static_cast(*this)(__x);} +#endif void swap(__unordered_map_hasher&__y) _NOEXCEPT_(__is_nothrow_swappable<_Hash>::value) { @@ -453,8 +483,8 @@ } }; -template -class __unordered_map_hasher<_Key, _Cp, _Hash, false> +template +class __unordered_map_hasher<_Key, _Cp, _Hash, _Pred, false> { _Hash __hash_; public: @@ -474,6 +504,12 @@ _LIBCPP_INLINE_VISIBILITY size_t operator()(const _Key& __x) const {return __hash_(__x);} +#if _LIBCPP_STD_VER > 17 + template ::value && __is_transparent<_Pred, _K2>::value>> + _LIBCPP_INLINE_VISIBILITY + size_t operator()(const _K2& __x) const + {return __hash_(__x);} +#endif void swap(__unordered_map_hasher&__y) _NOEXCEPT_(__is_nothrow_swappable<_Hash>::value) { @@ -482,17 +518,17 @@ } }; -template +template inline _LIBCPP_INLINE_VISIBILITY void -swap(__unordered_map_hasher<_Key, _Cp, _Hash, __b>& __x, - __unordered_map_hasher<_Key, _Cp, _Hash, __b>& __y) +swap(__unordered_map_hasher<_Key, _Cp, _Hash, _Pred, __b>& __x, + __unordered_map_hasher<_Key, _Cp, _Hash, _Pred, __b>& __y) _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) { __x.swap(__y); } -template ::value && !__libcpp_is_final<_Pred>::value> class __unordered_map_equal : private _Pred @@ -517,6 +553,24 @@ _LIBCPP_INLINE_VISIBILITY bool operator()(const _Key& __x, const _Cp& __y) const {return static_cast(*this)(__x, __y.__get_value().first);} +#if _LIBCPP_STD_VER > 17 + template ::value && __is_transparent<_Pred, _K2>::value>> + _LIBCPP_INLINE_VISIBILITY + bool operator()(const _Cp& __x, const _K2& __y) const + {return static_cast(*this)(__x.__get_value().first, __y);} + template ::value && __is_transparent<_Pred, _K2>::value>> + _LIBCPP_INLINE_VISIBILITY + bool operator()(const _K2& __x, const _Cp& __y) const + {return static_cast(*this)(__x, __y.__get_value().first);} + template ::value && __is_transparent<_Pred, _K2>::value>> + _LIBCPP_INLINE_VISIBILITY + bool operator()(const _Key& __x, const _K2& __y) const + {return static_cast(*this)(__x, __y);} + template ::value && __is_transparent<_Pred, _K2>::value>> + _LIBCPP_INLINE_VISIBILITY + bool operator()(const _K2& __x, const _Key& __y) const + {return static_cast(*this)(__x, __y);} +#endif void swap(__unordered_map_equal&__y) _NOEXCEPT_(__is_nothrow_swappable<_Pred>::value) { @@ -525,8 +579,8 @@ } }; -template -class __unordered_map_equal<_Key, _Cp, _Pred, false> +template +class __unordered_map_equal<_Key, _Cp, _Pred, _Hash, false> { _Pred __pred_; public: @@ -549,6 +603,24 @@ _LIBCPP_INLINE_VISIBILITY bool operator()(const _Key& __x, const _Cp& __y) const {return __pred_(__x, __y.__get_value().first);} +#if _LIBCPP_STD_VER > 17 + template ::value && __is_transparent<_Pred, _K2>::value>> + _LIBCPP_INLINE_VISIBILITY + bool operator()(const _Cp& __x, const _K2& __y) const + {return __pred_(__x.__get_value().first, __y);} + template ::value && __is_transparent<_Pred, _K2>::value>> + _LIBCPP_INLINE_VISIBILITY + bool operator()(const _K2& __x, const _Cp& __y) const + {return __pred_(__x, __y.__get_value().first);} + template ::value && __is_transparent<_Pred, _K2>::value>> + _LIBCPP_INLINE_VISIBILITY + bool operator()(const _Key& __x, const _K2& __y) const + {return __pred_(__x, __y);} + template ::value && __is_transparent<_Pred, _K2>::value>> + _LIBCPP_INLINE_VISIBILITY + bool operator()(const _K2& __x, const _Key& __y) const + {return __pred_(__x, __y);} +#endif void swap(__unordered_map_equal&__y) _NOEXCEPT_(__is_nothrow_swappable<_Pred>::value) { @@ -557,11 +629,11 @@ } }; -template +template inline _LIBCPP_INLINE_VISIBILITY void -swap(__unordered_map_equal<_Key, _Cp, _Pred, __b>& __x, - __unordered_map_equal<_Key, _Cp, _Pred, __b>& __y) +swap(__unordered_map_equal<_Key, _Cp, _Pred, _Hash, __b>& __x, + __unordered_map_equal<_Key, _Cp, _Pred, _Hash, __b>& __y) _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) { __x.swap(__y); @@ -858,11 +930,11 @@ "Invalid allocator::value_type"); private: - typedef __hash_value_type __value_type; - typedef __unordered_map_hasher __hasher; - typedef __unordered_map_equal __key_equal; + typedef __hash_value_type __value_type; + typedef __unordered_map_hasher __hasher; + typedef __unordered_map_equal __key_equal; typedef typename __rebind_alloc_helper, - __value_type>::type __allocator_type; + __value_type>::type __allocator_type; typedef __hash_table<__value_type, __hasher, __key_equal, __allocator_type> __table; @@ -1280,11 +1352,34 @@ iterator find(const key_type& __k) {return __table_.find(__k);} _LIBCPP_INLINE_VISIBILITY const_iterator find(const key_type& __k) const {return __table_.find(__k);} + + #if _LIBCPP_STD_VER > 17 + template + _LIBCPP_INLINE_VISIBILITY + _EnableIf<__is_transparent::value && __is_transparent::value, iterator> + find(const _K2& __k) {return __table_.find(__k);} + template + _LIBCPP_INLINE_VISIBILITY + _EnableIf<__is_transparent::value && __is_transparent::value, const_iterator> + find(const _K2& __k) const {return __table_.find(__k);} + #endif // _LIBCPP_STD_VER > 17 + _LIBCPP_INLINE_VISIBILITY size_type count(const key_type& __k) const {return __table_.__count_unique(__k);} + #if _LIBCPP_STD_VER > 17 + template + _LIBCPP_INLINE_VISIBILITY + _EnableIf<__is_transparent::value && __is_transparent::value, size_type> + count(const _K2& __k) const {return __table_.__count_unique(__k);} + #endif // _LIBCPP_STD_VER > 17 #if _LIBCPP_STD_VER > 17 _LIBCPP_INLINE_VISIBILITY bool contains(const key_type& __k) const {return find(__k) != end();} + + template + _LIBCPP_INLINE_VISIBILITY + _EnableIf<__is_transparent::value && __is_transparent::value, bool> + contains(const _K2& __k) const {return find(__k) != end();} #endif // _LIBCPP_STD_VER > 17 _LIBCPP_INLINE_VISIBILITY pair equal_range(const key_type& __k) @@ -1292,6 +1387,16 @@ _LIBCPP_INLINE_VISIBILITY pair equal_range(const key_type& __k) const {return __table_.__equal_range_unique(__k);} + #if _LIBCPP_STD_VER > 17 + template + _LIBCPP_INLINE_VISIBILITY + _EnableIf<__is_transparent::value && __is_transparent::value, pair> + equal_range(const _K2& __k) {return __table_.__equal_range_unique(__k);} + template + _LIBCPP_INLINE_VISIBILITY + _EnableIf<__is_transparent::value && __is_transparent::value, pair> + equal_range(const _K2& __k) const {return __table_.__equal_range_unique(__k);} + #endif // _LIBCPP_STD_VER > 17 mapped_type& operator[](const key_type& __k); #ifndef _LIBCPP_CXX03_LANG @@ -1762,11 +1867,11 @@ "Invalid allocator::value_type"); private: - typedef __hash_value_type __value_type; - typedef __unordered_map_hasher __hasher; - typedef __unordered_map_equal __key_equal; + typedef __hash_value_type __value_type; + typedef __unordered_map_hasher __hasher; + typedef __unordered_map_equal __key_equal; typedef typename __rebind_alloc_helper, - __value_type>::type __allocator_type; + __value_type>::type __allocator_type; typedef __hash_table<__value_type, __hasher, __key_equal, __allocator_type> __table; @@ -2059,11 +2164,32 @@ iterator find(const key_type& __k) {return __table_.find(__k);} _LIBCPP_INLINE_VISIBILITY const_iterator find(const key_type& __k) const {return __table_.find(__k);} + #if _LIBCPP_STD_VER > 17 + template + _LIBCPP_INLINE_VISIBILITY + _EnableIf<__is_transparent::value && __is_transparent::value, iterator> + find(const _K2& __k) {return __table_.find(__k);} + template + _LIBCPP_INLINE_VISIBILITY + _EnableIf<__is_transparent::value && __is_transparent::value, const_iterator> + find(const _K2& __k) const {return __table_.find(__k);} + #endif // _LIBCPP_STD_VER > 17 _LIBCPP_INLINE_VISIBILITY size_type count(const key_type& __k) const {return __table_.__count_multi(__k);} + #if _LIBCPP_STD_VER > 17 + template + _LIBCPP_INLINE_VISIBILITY + _EnableIf<__is_transparent::value && __is_transparent::value, size_type> + count(const _K2& __k) const {return __table_.__count_multi(__k);} + #endif // _LIBCPP_STD_VER > 17 #if _LIBCPP_STD_VER > 17 _LIBCPP_INLINE_VISIBILITY bool contains(const key_type& __k) const {return find(__k) != end();} + + template + _LIBCPP_INLINE_VISIBILITY + _EnableIf<__is_transparent::value && __is_transparent::value, bool> + contains(const _K2& __k) const {return find(__k) != end();} #endif // _LIBCPP_STD_VER > 17 _LIBCPP_INLINE_VISIBILITY pair equal_range(const key_type& __k) @@ -2071,6 +2197,16 @@ _LIBCPP_INLINE_VISIBILITY pair equal_range(const key_type& __k) const {return __table_.__equal_range_multi(__k);} + #if _LIBCPP_STD_VER > 17 + template + _LIBCPP_INLINE_VISIBILITY + _EnableIf<__is_transparent::value && __is_transparent::value, pair> + equal_range(const _K2& __k) {return __table_.__equal_range_multi(__k);} + template + _LIBCPP_INLINE_VISIBILITY + _EnableIf<__is_transparent::value && __is_transparent::value, pair> + equal_range(const _K2& __k) const {return __table_.__equal_range_multi(__k);} + #endif // _LIBCPP_STD_VER > 17 _LIBCPP_INLINE_VISIBILITY size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();} diff --git a/libcxx/include/unordered_set b/libcxx/include/unordered_set --- a/libcxx/include/unordered_set +++ b/libcxx/include/unordered_set @@ -145,10 +145,22 @@ iterator find(const key_type& k); const_iterator find(const key_type& k) const; + template + iterator find(const K& x); // C++20 + template + const_iterator find(const K& x) const; // C++20 size_type count(const key_type& k) const; + template + size_type count(const K& k) const; // C++20 bool contains(const key_type& k) const; // C++20 + template + bool contains(const K& k) const; // C++20 pair equal_range(const key_type& k); pair equal_range(const key_type& k) const; + template + pair equal_range(const K& k); // C++20 + template + pair equal_range(const K& k) const; // C++20 size_type bucket_count() const noexcept; size_type max_bucket_count() const noexcept; @@ -310,10 +322,22 @@ iterator find(const key_type& k); const_iterator find(const key_type& k) const; + template + iterator find(const K& x); // C++20 + template + const_iterator find(const K& x) const; // C++20 size_type count(const key_type& k) const; + template + size_type count(const K& k) const; // C++20 bool contains(const key_type& k) const; // C++20 + template + bool contains(const K& k) const; // C++20 pair equal_range(const key_type& k); pair equal_range(const key_type& k) const; + template + pair equal_range(const K& k); // C++20 + template + pair equal_range(const K& k) const; // C++20 size_type bucket_count() const noexcept; size_type max_bucket_count() const noexcept; @@ -679,11 +703,32 @@ iterator find(const key_type& __k) {return __table_.find(__k);} _LIBCPP_INLINE_VISIBILITY const_iterator find(const key_type& __k) const {return __table_.find(__k);} + #if _LIBCPP_STD_VER > 17 + template + _LIBCPP_INLINE_VISIBILITY + _EnableIf<__is_transparent::value && __is_transparent::value, iterator> + find(const _K2& __k) {return __table_.find(__k);} + template + _LIBCPP_INLINE_VISIBILITY + _EnableIf<__is_transparent::value && __is_transparent::value, const_iterator> + find(const _K2& __k) const {return __table_.find(__k);} + #endif // _LIBCPP_STD_VER > 17 _LIBCPP_INLINE_VISIBILITY size_type count(const key_type& __k) const {return __table_.__count_unique(__k);} + #if _LIBCPP_STD_VER > 17 + template + _LIBCPP_INLINE_VISIBILITY + _EnableIf<__is_transparent::value && __is_transparent::value, size_type> + count(const _K2& __k) const {return __table_.__count_unique(__k);} + #endif // _LIBCPP_STD_VER > 17 #if _LIBCPP_STD_VER > 17 _LIBCPP_INLINE_VISIBILITY bool contains(const key_type& __k) const {return find(__k) != end();} + + template + _LIBCPP_INLINE_VISIBILITY + _EnableIf<__is_transparent::value && __is_transparent::value, bool> + contains(const _K2& __k) const {return find(__k) != end();} #endif // _LIBCPP_STD_VER > 17 _LIBCPP_INLINE_VISIBILITY pair equal_range(const key_type& __k) @@ -691,6 +736,16 @@ _LIBCPP_INLINE_VISIBILITY pair equal_range(const key_type& __k) const {return __table_.__equal_range_unique(__k);} + #if _LIBCPP_STD_VER > 17 + template + _LIBCPP_INLINE_VISIBILITY + _EnableIf<__is_transparent::value && __is_transparent::value, pair> + equal_range(const _K2& __k) {return __table_.__equal_range_unique(__k);} + template + _LIBCPP_INLINE_VISIBILITY + _EnableIf<__is_transparent::value && __is_transparent::value, pair> + equal_range(const _K2& __k) const {return __table_.__equal_range_unique(__k);} + #endif // _LIBCPP_STD_VER > 17 _LIBCPP_INLINE_VISIBILITY size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();} @@ -1314,11 +1369,32 @@ iterator find(const key_type& __k) {return __table_.find(__k);} _LIBCPP_INLINE_VISIBILITY const_iterator find(const key_type& __k) const {return __table_.find(__k);} + #if _LIBCPP_STD_VER > 17 + template + _LIBCPP_INLINE_VISIBILITY + _EnableIf<__is_transparent::value && __is_transparent::value, iterator> + find(const _K2& __k) {return __table_.find(__k);} + template + _LIBCPP_INLINE_VISIBILITY + _EnableIf<__is_transparent::value && __is_transparent::value, const_iterator> + find(const _K2& __k) const {return __table_.find(__k);} + #endif // _LIBCPP_STD_VER > 17 _LIBCPP_INLINE_VISIBILITY size_type count(const key_type& __k) const {return __table_.__count_multi(__k);} + #if _LIBCPP_STD_VER > 17 + template + _LIBCPP_INLINE_VISIBILITY + _EnableIf<__is_transparent::value && __is_transparent::value, size_type> + count(const _K2& __k) const {return __table_.__count_multi(__k);} + #endif // _LIBCPP_STD_VER > 17 #if _LIBCPP_STD_VER > 17 _LIBCPP_INLINE_VISIBILITY bool contains(const key_type& __k) const {return find(__k) != end();} + + template + _LIBCPP_INLINE_VISIBILITY + _EnableIf<__is_transparent::value && __is_transparent::value, bool> + contains(const _K2& __k) const {return find(__k) != end();} #endif // _LIBCPP_STD_VER > 17 _LIBCPP_INLINE_VISIBILITY pair equal_range(const key_type& __k) @@ -1326,6 +1402,16 @@ _LIBCPP_INLINE_VISIBILITY pair equal_range(const key_type& __k) const {return __table_.__equal_range_multi(__k);} + #if _LIBCPP_STD_VER > 17 + template + _LIBCPP_INLINE_VISIBILITY + _EnableIf<__is_transparent::value && __is_transparent::value, pair> + equal_range(const _K2& __k) {return __table_.__equal_range_multi(__k);} + template + _LIBCPP_INLINE_VISIBILITY + _EnableIf<__is_transparent::value && __is_transparent::value, pair> + equal_range(const _K2& __k) const {return __table_.__equal_range_multi(__k);} + #endif // _LIBCPP_STD_VER > 17 _LIBCPP_INLINE_VISIBILITY size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();} diff --git a/libcxx/include/version b/libcxx/include/version --- a/libcxx/include/version +++ b/libcxx/include/version @@ -260,7 +260,7 @@ # endif # define __cpp_lib_endian 201907L # define __cpp_lib_erase_if 202002L -// # define __cpp_lib_generic_unordered_lookup 201811L +# define __cpp_lib_generic_unordered_lookup 201811L # define __cpp_lib_interpolate 201902L # if !defined(_LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED) # define __cpp_lib_is_constant_evaluated 201811L diff --git a/libcxx/test/std/containers/unord/unord.map/contains.transparent.pass.cpp b/libcxx/test/std/containers/unord/unord.map/contains.transparent.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/containers/unord/unord.map/contains.transparent.pass.cpp @@ -0,0 +1,62 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// template , class Pred = equal_to, +// class Alloc = allocator>> +// class unordered_map + +// template +// bool contains(const K& x) const; + +// UNSUPPORTED: c++03, c++11, c++14, c++17 + +#include +#include "test_transparent_unordered.h" + +int main(int, char**) +{ + using key_type = StoredType; + using ilist_type = std::initializer_list >; + + { + // Make sure conversions don't happen for transparent non-final hasher and key_equal + using map_type = const unord_map_type >; + test_transparent_contains(ilist_type{{1, 2}, {2, 3}}); + } + + { + // Make sure conversions don't happen for transparent final hasher and key_equal + using map_type = const unord_map_type; + test_transparent_contains(ilist_type{{1, 2}, {2, 3}}); + } + + { + // Make sure conversions do happen for non-transparent hasher + using map_type = const unord_map_type >; + test_non_transparent_contains(ilist_type{{1, 2}, {2, 3}}); + } + + { + // Make sure conversions do happen for non-transparent key_equal + using map_type = const unord_map_type >; + test_non_transparent_contains(ilist_type{{1, 2}, {2, 3}}); + } + + { + // Make sure conversions do happen for both non-transparent hasher and key_equal + using map_type = const unord_map_type >; + test_non_transparent_contains(ilist_type{{1, 2}, {2, 3}}); + } + + return 0; +} diff --git a/libcxx/test/std/containers/unord/unord.map/count.transparent.pass.cpp b/libcxx/test/std/containers/unord/unord.map/count.transparent.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/containers/unord/unord.map/count.transparent.pass.cpp @@ -0,0 +1,63 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// template , class Pred = equal_to, +// class Alloc = allocator>> +// class unordered_map + +// template +// size_type count(const K& k) const; + +// UNSUPPORTED: c++03, c++11, c++14, c++17 + +#include + +#include "test_transparent_unordered.h" + +int main(int, char**) +{ + using key_type = StoredType; + using ilist_type = std::initializer_list >; + + { + // Make sure conversions don't happen for transparent non-final hasher and key_equal + using map_type = const unord_map_type >; + test_transparent_count(ilist_type{{1, 2}, {2, 3}}); + } + + { + // Make sure conversions don't happen for transparent final hasher and key_equal + using map_type = + const unord_map_type; + test_transparent_count(ilist_type{{1, 2}, {2, 3}}); + } + + { + // Make sure conversions do happen for non-transparent hasher + using map_type = const unord_map_type >; + test_non_transparent_count(ilist_type{{1, 2}, {2, 3}}); + } + + { + // Make sure conversions do happen for non-transparent key_equal + using map_type = + const unord_map_type >; + test_non_transparent_count(ilist_type{{1, 2}, {2, 3}}); + } + + { + // Make sure conversions do happen for both non-transparent hasher and key_equal + using map_type = + const unord_map_type >; + test_non_transparent_count(ilist_type{{1, 2}, {2, 3}}); + } + + return 0; +} diff --git a/libcxx/test/std/containers/unord/unord.map/equal_range_const.transparent.pass.cpp b/libcxx/test/std/containers/unord/unord.map/equal_range_const.transparent.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/containers/unord/unord.map/equal_range_const.transparent.pass.cpp @@ -0,0 +1,65 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// template , class Pred = equal_to, +// class Alloc = allocator>> +// class unordered_map + +// template +// pair equal_range(const K& k) const; + +// UNSUPPORTED: c++03, c++11, c++14, c++17 + +#include + +#include "test_transparent_unordered.h" + +int main(int, char**) +{ + using key_type = StoredType; + using ilist_type = std::initializer_list >; + + { + // Make sure conversions don't happen for transparent non-final hasher and key_equal + using map_type = const unord_map_type >; + test_transparent_equal_range(ilist_type{{1, 2}, {2, 3}}); + } + + { + // Make sure conversions don't happen for transparent final hasher and key_equal + using map_type = const unord_map_type; + test_transparent_equal_range(ilist_type{{1, 2}, {2, 3}}); + } + + { + // Make sure conversions do happen for non-transparent hasher + using map_type = const unord_map_type >; + test_non_transparent_equal_range(ilist_type{{1, 2}, {2, 3}}); + } + + { + // Make sure conversions do happen for non-transparent key_equal + using map_type = const unord_map_type >; + test_non_transparent_equal_range(ilist_type{{1, 2}, {2, 3}}); + } + + { + // Make sure conversions do happen for both non-transparent hasher and key_equal + using map_type = const unord_map_type >; + test_non_transparent_equal_range(ilist_type{{1, 2}, {2, 3}}); + } + + return 0; +} diff --git a/libcxx/test/std/containers/unord/unord.map/equal_range_non_const.transparent.pass.cpp b/libcxx/test/std/containers/unord/unord.map/equal_range_non_const.transparent.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/containers/unord/unord.map/equal_range_non_const.transparent.pass.cpp @@ -0,0 +1,65 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// template , class Pred = equal_to, +// class Alloc = allocator>> +// class unordered_map + +// template +// pair equal_range(const K& k); + +// UNSUPPORTED: c++03, c++11, c++14, c++17 + +#include + +#include "test_transparent_unordered.h" + +int main(int, char**) +{ + using key_type = StoredType; + using ilist_type = std::initializer_list >; + + { + // Make sure conversions don't happen for transparent non-final hasher and key_equal + using map_type = unord_map_type >; + test_transparent_equal_range(ilist_type{{1, 2}, {2, 3}}); + } + + { + // Make sure conversions don't happen for transparent final hasher and key_equal + using map_type = unord_map_type; + test_transparent_equal_range(ilist_type{{1, 2}, {2, 3}}); + } + + { + // Make sure conversions do happen for non-transparent hasher + using map_type = unord_map_type >; + test_non_transparent_equal_range(ilist_type{{1, 2}, {2, 3}}); + } + + { + // Make sure conversions do happen for non-transparent key_equal + using map_type = unord_map_type >; + test_non_transparent_equal_range(ilist_type{{1, 2}, {2, 3}}); + } + + { + // Make sure conversions do happen for both non-transparent hasher and key_equal + using map_type = unord_map_type >; + test_non_transparent_equal_range(ilist_type{{1, 2}, {2, 3}}); + } + + return 0; +} diff --git a/libcxx/test/std/containers/unord/unord.map/find_const.transparent.pass.cpp b/libcxx/test/std/containers/unord/unord.map/find_const.transparent.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/containers/unord/unord.map/find_const.transparent.pass.cpp @@ -0,0 +1,65 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// template , class Pred = equal_to, +// class Alloc = allocator>> +// class unordered_map + +// template +// const_iterator find(const K& k) const; + +// UNSUPPORTED: c++03, c++11, c++14, c++17 + +#include + +#include "test_transparent_unordered.h" + +int main(int, char**) +{ + using key_type = StoredType; + using ilist_type = std::initializer_list >; + + { + // Make sure conversions don't happen for transparent non-final hasher and key_equal + using map_type = const unord_map_type >; + test_transparent_find(ilist_type{{1, 2}, {2, 3}}); + } + + { + // Make sure conversions don't happen for transparent final hasher and key_equal + using map_type = const unord_map_type; + test_transparent_find(ilist_type{{1, 2}, {2, 3}}); + } + + { + // Make sure conversions do happen for non-transparent hasher + using map_type = const unord_map_type >; + test_non_transparent_find(ilist_type{{1, 2}, {2, 3}}); + } + + { + // Make sure conversions do happen for non-transparent key_equal + using map_type = const unord_map_type >; + test_non_transparent_find(ilist_type{{1, 2}, {2, 3}}); + } + + { + // Make sure conversions do happen for both non-transparent hasher and key_equal + using map_type = const unord_map_type >; + test_non_transparent_find(ilist_type{{1, 2}, {2, 3}}); + } + + return 0; +} diff --git a/libcxx/test/std/containers/unord/unord.map/find_non_const.transparent.pass.cpp b/libcxx/test/std/containers/unord/unord.map/find_non_const.transparent.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/containers/unord/unord.map/find_non_const.transparent.pass.cpp @@ -0,0 +1,65 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// template , class Pred = equal_to, +// class Alloc = allocator>> +// class unordered_map + +// template +// iterator find(const K& k); + +// UNSUPPORTED: c++03, c++11, c++14, c++17 + +#include + +#include "test_transparent_unordered.h" + +int main(int, char**) +{ + using key_type = StoredType; + using ilist_type = std::initializer_list >; + + { + // Make sure conversions don't happen for transparent non-final hasher and key_equal + using map_type = unord_map_type >; + test_transparent_find(ilist_type{{1, 2}, {2, 3}}); + } + + { + // Make sure conversions don't happen for transparent final hasher and key_equal + using map_type = unord_map_type; + test_transparent_find(ilist_type{{1, 2}, {2, 3}}); + } + + { + // Make sure conversions do happen for non-transparent hasher + using map_type = unord_map_type >; + test_non_transparent_find(ilist_type{{1, 2}, {2, 3}}); + } + + { + // Make sure conversions do happen for non-transparent key_equal + using map_type = unord_map_type >; + test_non_transparent_find(ilist_type{{1, 2}, {2, 3}}); + } + + { + // Make sure conversions do happen for both non-transparent hasher and key_equal + using map_type = unord_map_type >; + test_non_transparent_find(ilist_type{{1, 2}, {2, 3}}); + } + + return 0; +} diff --git a/libcxx/test/std/containers/unord/unord.multimap/contains.transparent.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/contains.transparent.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/containers/unord/unord.multimap/contains.transparent.pass.cpp @@ -0,0 +1,65 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// template , class Pred = equal_to, +// class Alloc = allocator>> +// class unordered_multimap + +// template +// bool contains(const K& x) const; + +// UNSUPPORTED: c++03, c++11, c++14, c++17 + +#include +#include "test_transparent_unordered.h" + +int main(int, char**) +{ + using key_type = StoredType; + using ilist_type = std::initializer_list >; + + { + // Make sure conversions don't happen for transparent non-final hasher and key_equal + using map_type = unord_map_type >; + test_transparent_contains(ilist_type{{1, 2}, {1, 3}, {2, 3}}); + } + + { + // Make sure conversions don't happen for transparent final hasher and key_equal + using map_type = unord_map_type; + test_transparent_contains(ilist_type{{1, 2}, {1, 3}, {2, 3}}); + } + + { + // Make sure conversions do happen for non-transparent hasher + using map_type = unord_map_type >; + test_non_transparent_contains(ilist_type{{1, 2}, {1, 3}, {2, 3}}); + } + + { + // Make sure conversions do happen for non-transparent key_equal + using map_type = unord_map_type >; + test_non_transparent_contains( + ilist_type{{1, 2}, {1, 3}, {2, 3}}); + } + + { + // Make sure conversions do happen for both non-transparent hasher and key_equal + using map_type = unord_map_type >; + test_non_transparent_contains( + ilist_type{{1, 2}, {1, 3}, {2, 3}}); + } + + return 0; +} diff --git a/libcxx/test/std/containers/unord/unord.multimap/count.transparent.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/count.transparent.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/containers/unord/unord.multimap/count.transparent.pass.cpp @@ -0,0 +1,63 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// template , class Pred = equal_to, +// class Alloc = allocator>> +// class unordered_multimap + +// template +// size_type count(const K& k) const; + +// UNSUPPORTED: c++03, c++11, c++14, c++17 + +#include + +#include "test_transparent_unordered.h" + +int main(int, char**) +{ + using key_type = StoredType; + using ilist_type = std::initializer_list >; + + { + // Make sure conversions don't happen for transparent non-final hasher and key_equal + using map_type = const unord_map_type >; + test_transparent_count(ilist_type{{1, 2}, {1, 3}, {2, 3}}); + } + + { + // Make sure conversions don't happen for transparent final hasher and key_equal + using map_type = + const unord_map_type; + test_transparent_count(ilist_type{{1, 2}, {1, 3}, {2, 3}}); + } + + { + // Make sure conversions do happen for non-transparent hasher + using map_type = const unord_map_type >; + test_non_transparent_count(ilist_type{{1, 2}, {1, 3}, {2, 3}}); + } + + { + // Make sure conversions do happen for non-transparent key_equal + using map_type = + const unord_map_type >; + test_non_transparent_count(ilist_type{{1, 2}, {1, 3}, {2, 3}}); + } + + { + // Make sure conversions do happen for both non-transparent hasher and key_equal + using map_type = + const unord_map_type >; + test_non_transparent_count(ilist_type{{1, 2}, {1, 3}, {2, 3}}); + } + + return 0; +} diff --git a/libcxx/test/std/containers/unord/unord.multimap/equal_range_const.transparent.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/equal_range_const.transparent.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/containers/unord/unord.multimap/equal_range_const.transparent.pass.cpp @@ -0,0 +1,65 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// template , class Pred = equal_to, +// class Alloc = allocator>> +// class unordered_multimap + +// template +// pair equal_range(const K& k) const; + +// UNSUPPORTED: c++03, c++11, c++14, c++17 + +#include + +#include "test_transparent_unordered.h" + +int main(int, char**) +{ + using key_type = StoredType; + using ilist_type = std::initializer_list >; + + { + // Make sure conversions don't happen for transparent non-final hasher and key_equal + using map_type = const unord_map_type >; + test_transparent_equal_range(ilist_type{{1, 2}, {1, 3}, {2, 3}}); + } + + { + // Make sure conversions don't happen for transparent final hasher and key_equal + using map_type = const unord_map_type; + test_transparent_equal_range(ilist_type{{1, 2}, {1, 3}, {2, 3}}); + } + + { + // Make sure conversions do happen for non-transparent hasher + using map_type = const unord_map_type >; + test_non_transparent_equal_range(ilist_type{{1, 2}, {1, 3}, {2, 3}}); + } + + { + // Make sure conversions do happen for non-transparent key_equal + using map_type = const unord_map_type >; + test_non_transparent_equal_range(ilist_type{{1, 2}, {1, 3}, {2, 3}}); + } + + { + // Make sure conversions do happen for both non-transparent hasher and key_equal + using map_type = const unord_map_type >; + test_non_transparent_equal_range(ilist_type{{1, 2}, {1, 3}, {2, 3}}); + } + + return 0; +} diff --git a/libcxx/test/std/containers/unord/unord.multimap/equal_range_non_const.transparent.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/equal_range_non_const.transparent.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/containers/unord/unord.multimap/equal_range_non_const.transparent.pass.cpp @@ -0,0 +1,65 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// template , class Pred = equal_to, +// class Alloc = allocator>> +// class unordered_multimap + +// template +// pair equal_range(const K& k); + +// UNSUPPORTED: c++03, c++11, c++14, c++17 + +#include + +#include "test_transparent_unordered.h" + +int main(int, char**) +{ + using key_type = StoredType; + using ilist_type = std::initializer_list >; + + { + // Make sure conversions don't happen for transparent non-final hasher and key_equal + using map_type = unord_map_type >; + test_transparent_equal_range(ilist_type{{1, 2}, {1, 3}, {2, 3}}); + } + + { + // Make sure conversions don't happen for transparent final hasher and key_equal + using map_type = unord_map_type; + test_transparent_equal_range(ilist_type{{1, 2}, {1, 3}, {2, 3}}); + } + + { + // Make sure conversions do happen for non-transparent hasher + using map_type = unord_map_type >; + test_non_transparent_equal_range(ilist_type{{1, 2}, {1, 3}, {2, 3}}); + } + + { + // Make sure conversions do happen for non-transparent key_equal + using map_type = unord_map_type >; + test_non_transparent_equal_range(ilist_type{{1, 2}, {1, 3}, {2, 3}}); + } + + { + // Make sure conversions do happen for both non-transparent hasher and key_equal + using map_type = unord_map_type >; + test_non_transparent_equal_range(ilist_type{{1, 2}, {1, 3}, {2, 3}}); + } + + return 0; +} diff --git a/libcxx/test/std/containers/unord/unord.multimap/find_const.transparent.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/find_const.transparent.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/containers/unord/unord.multimap/find_const.transparent.pass.cpp @@ -0,0 +1,65 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// template , class Pred = equal_to, +// class Alloc = allocator>> +// class unordered_multimap + +// template +// const_iterator find(const K& k) const; + +// UNSUPPORTED: c++03, c++11, c++14, c++17 + +#include + +#include "test_transparent_unordered.h" + +int main(int, char**) +{ + using key_type = StoredType; + using ilist_type = std::initializer_list >; + + { + // Make sure conversions don't happen for transparent non-final hasher and key_equal + using map_type = const unord_map_type >; + test_transparent_find(ilist_type{{1, 2}, {1, 3}, {2, 3}}); + } + + { + // Make sure conversions don't happen for transparent final hasher and key_equal + using map_type = const unord_map_type; + test_transparent_find(ilist_type{{1, 2}, {1, 3}, {2, 3}}); + } + + { + // Make sure conversions do happen for non-transparent hasher + using map_type = const unord_map_type >; + test_non_transparent_find(ilist_type{{1, 2}, {1, 3}, {2, 3}}); + } + + { + // Make sure conversions do happen for non-transparent key_equal + using map_type = const unord_map_type >; + test_non_transparent_find(ilist_type{{1, 2}, {1, 3}, {2, 3}}); + } + + { + // Make sure conversions do happen for both non-transparent hasher and key_equal + using map_type = const unord_map_type >; + test_non_transparent_find(ilist_type{{1, 2}, {1, 3}, {2, 3}}); + } + + return 0; +} diff --git a/libcxx/test/std/containers/unord/unord.multimap/find_non_const.transparent.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/find_non_const.transparent.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/containers/unord/unord.multimap/find_non_const.transparent.pass.cpp @@ -0,0 +1,65 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// template , class Pred = equal_to, +// class Alloc = allocator>> +// class unordered_multimap + +// template +// iterator find(const K& k); + +// UNSUPPORTED: c++03, c++11, c++14, c++17 + +#include + +#include "test_transparent_unordered.h" + +int main(int, char**) +{ + using key_type = StoredType; + using ilist_type = std::initializer_list >; + + { + // Make sure conversions don't happen for transparent non-final hasher and key_equal + using map_type = unord_map_type >; + test_transparent_find(ilist_type{{1, 2}, {1, 3}, {2, 3}}); + } + + { + // Make sure conversions don't happen for transparent final hasher and key_equal + using map_type = unord_map_type; + test_transparent_find(ilist_type{{1, 2}, {1, 3}, {2, 3}}); + } + + { + // Make sure conversions do happen for non-transparent hasher + using map_type = unord_map_type >; + test_non_transparent_find(ilist_type{{1, 2}, {1, 3}, {2, 3}}); + } + + { + // Make sure conversions do happen for non-transparent key_equal + using map_type = unord_map_type >; + test_non_transparent_find(ilist_type{{1, 2}, {1, 3}, {2, 3}}); + } + + { + // Make sure conversions do happen for both non-transparent hasher and key_equal + using map_type = unord_map_type >; + test_non_transparent_find(ilist_type{{1, 2}, {1, 3}, {2, 3}}); + } + + return 0; +} diff --git a/libcxx/test/std/containers/unord/unord.multiset/contains.transparent.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/contains.transparent.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/containers/unord/unord.multiset/contains.transparent.pass.cpp @@ -0,0 +1,64 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// template , class Pred = equal_to, +// class Alloc = allocator> +// class unordered_multiset + +// template +// bool contains(const K& x) const; + +// UNSUPPORTED: c++03, c++11, c++14, c++17 + +#include +#include "test_transparent_unordered.h" + +int main(int, char**) +{ + using key_type = StoredType; + + { + // Make sure conversions don't happen for transparent non-final hasher and key_equal + using set_type = unord_set_type >; + test_transparent_contains(key_type{1}, key_type{1}, key_type{2}); + } + + { + // Make sure conversions don't happen for transparent final hasher and key_equal + using set_type = unord_set_type; + test_transparent_contains(key_type{1}, key_type{1}, key_type{2}); + } + + { + // Make sure conversions do happen for non-transparent hasher + using set_type = unord_set_type >; + test_non_transparent_contains(key_type{1}, key_type{1}, key_type{2}); + } + + { + // Make sure conversions do happen for non-transparent key_equal + using set_type = unord_set_type >; + test_non_transparent_contains( + key_type{1}, key_type{1}, key_type{2}); + } + + { + // Make sure conversions do happen for both non-transparent hasher and key_equal + using set_type = unord_set_type >; + test_non_transparent_contains( + key_type{1}, key_type{1}, key_type{2}); + } + + return 0; +} diff --git a/libcxx/test/std/containers/unord/unord.multiset/count.transparent.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/count.transparent.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/containers/unord/unord.multiset/count.transparent.pass.cpp @@ -0,0 +1,62 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// template , class Pred = equal_to, +// class Alloc = allocator>> +// class unordered_multiset + +// template +// size_type count(const K& k) const; + +// UNSUPPORTED: c++03, c++11, c++14, c++17 + +#include + +#include "test_transparent_unordered.h" + +int main(int, char**) +{ + using key_type = StoredType; + + { + // Make sure conversions don't happen for transparent non-final hasher and key_equal + using set_type = const unord_set_type >; + test_transparent_count(key_type{1}, key_type{1}, key_type{2}); + } + + { + // Make sure conversions don't happen for transparent final hasher and key_equal + using set_type = + const unord_set_type; + test_transparent_count(key_type{1}, key_type{1}, key_type{2}); + } + + { + // Make sure conversions do happen for non-transparent hasher + using set_type = const unord_set_type >; + test_non_transparent_count(key_type{1}, key_type{1}, key_type{2}); + } + + { + // Make sure conversions do happen for non-transparent key_equal + using set_type = + const unord_set_type >; + test_non_transparent_count(key_type{1}, key_type{1}, key_type{2}); + } + + { + // Make sure conversions do happen for both non-transparent hasher and key_equal + using set_type = + const unord_set_type >; + test_non_transparent_count(key_type{1}, key_type{1}, key_type{2}); + } + + return 0; +} diff --git a/libcxx/test/std/containers/unord/unord.multiset/equal_range_const.transparent.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/equal_range_const.transparent.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/containers/unord/unord.multiset/equal_range_const.transparent.pass.cpp @@ -0,0 +1,64 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// template , class Pred = equal_to, +// class Alloc = allocator>> +// class unordered_multiset + +// template +// pair equal_range(const K& k) const; + +// UNSUPPORTED: c++03, c++11, c++14, c++17 + +#include + +#include "test_transparent_unordered.h" + +int main(int, char**) +{ + using key_type = StoredType; + + { + // Make sure conversions don't happen for transparent non-final hasher and key_equal + using set_type = const unord_set_type >; + test_transparent_equal_range(key_type{1}, key_type{1}, key_type{2}); + } + + { + // Make sure conversions don't happen for transparent final hasher and key_equal + using set_type = const unord_set_type; + test_transparent_equal_range(key_type{1}, key_type{1}, key_type{2}); + } + + { + // Make sure conversions do happen for non-transparent hasher + using set_type = const unord_set_type >; + test_non_transparent_equal_range(key_type{1}, key_type{1}, key_type{2}); + } + + { + // Make sure conversions do happen for non-transparent key_equal + using set_type = const unord_set_type >; + test_non_transparent_equal_range(key_type{1}, key_type{1}, key_type{2}); + } + + { + // Make sure conversions do happen for both non-transparent hasher and key_equal + using set_type = const unord_set_type >; + test_non_transparent_equal_range(key_type{1}, key_type{1}, key_type{2}); + } + + return 0; +} diff --git a/libcxx/test/std/containers/unord/unord.multiset/equal_range_non_const.transparent.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/equal_range_non_const.transparent.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/containers/unord/unord.multiset/equal_range_non_const.transparent.pass.cpp @@ -0,0 +1,64 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// template , class Pred = equal_to, +// class Alloc = allocator>> +// class unordered_multiset + +// template +// pair equal_range(const K& k); + +// UNSUPPORTED: c++03, c++11, c++14, c++17 + +#include + +#include "test_transparent_unordered.h" + +int main(int, char**) +{ + using key_type = StoredType; + + { + // Make sure conversions don't happen for transparent non-final hasher and key_equal + using set_type = unord_set_type >; + test_transparent_equal_range(key_type{1}, key_type{1}, key_type{2}); + } + + { + // Make sure conversions don't happen for transparent final hasher and key_equal + using set_type = unord_set_type; + test_transparent_equal_range(key_type{1}, key_type{1}, key_type{2}); + } + + { + // Make sure conversions do happen for non-transparent hasher + using set_type = unord_set_type >; + test_non_transparent_equal_range(key_type{1}, key_type{1}, key_type{2}); + } + + { + // Make sure conversions do happen for non-transparent key_equal + using set_type = unord_set_type >; + test_non_transparent_equal_range(key_type{1}, key_type{1}, key_type{2}); + } + + { + // Make sure conversions do happen for both non-transparent hasher and key_equal + using set_type = unord_set_type >; + test_non_transparent_equal_range(key_type{1}, key_type{1}, key_type{2}); + } + + return 0; +} diff --git a/libcxx/test/std/containers/unord/unord.multiset/find_const.transparent.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/find_const.transparent.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/containers/unord/unord.multiset/find_const.transparent.pass.cpp @@ -0,0 +1,64 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// template , class Pred = equal_to, +// class Alloc = allocator>> +// class unordered_multiset + +// template +// const_iterator find(const K& k) const; + +// UNSUPPORTED: c++03, c++11, c++14, c++17 + +#include + +#include "test_transparent_unordered.h" + +int main(int, char**) +{ + using key_type = StoredType; + + { + // Make sure conversions don't happen for transparent non-final hasher and key_equal + using set_type = const unord_set_type >; + test_transparent_find(key_type{1}, key_type{1}, key_type{2}); + } + + { + // Make sure conversions don't happen for transparent final hasher and key_equal + using set_type = const unord_set_type; + test_transparent_find(key_type{1}, key_type{1}, key_type{2}); + } + + { + // Make sure conversions do happen for non-transparent hasher + using set_type = const unord_set_type >; + test_non_transparent_find(key_type{1}, key_type{1}, key_type{2}); + } + + { + // Make sure conversions do happen for non-transparent key_equal + using set_type = const unord_set_type >; + test_non_transparent_find(key_type{1}, key_type{1}, key_type{2}); + } + + { + // Make sure conversions do happen for both non-transparent hasher and key_equal + using set_type = const unord_set_type >; + test_non_transparent_find(key_type{1}, key_type{1}, key_type{2}); + } + + return 0; +} diff --git a/libcxx/test/std/containers/unord/unord.multiset/find_non_const.transparent.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/find_non_const.transparent.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/containers/unord/unord.multiset/find_non_const.transparent.pass.cpp @@ -0,0 +1,64 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// template , class Pred = equal_to, +// class Alloc = allocator>> +// class unordered_multiset + +// template +// iterator find(const K& k); + +// UNSUPPORTED: c++03, c++11, c++14, c++17 + +#include + +#include "test_transparent_unordered.h" + +int main(int, char**) +{ + using key_type = StoredType; + + { + // Make sure conversions don't happen for transparent non-final hasher and key_equal + using set_type = unord_set_type >; + test_transparent_find(key_type{1}, key_type{1}, key_type{2}); + } + + { + // Make sure conversions don't happen for transparent final hasher and key_equal + using set_type = unord_set_type; + test_transparent_find(key_type{1}, key_type{1}, key_type{2}); + } + + { + // Make sure conversions do happen for non-transparent hasher + using set_type = unord_set_type >; + test_non_transparent_find(key_type{1}, key_type{1}, key_type{2}); + } + + { + // Make sure conversions do happen for non-transparent key_equal + using set_type = unord_set_type >; + test_non_transparent_find(key_type{1}, key_type{1}, key_type{2}); + } + + { + // Make sure conversions do happen for both non-transparent hasher and key_equal + using set_type = unord_set_type >; + test_non_transparent_find(key_type{1}, key_type{1}, key_type{2}); + } + + return 0; +} diff --git a/libcxx/test/std/containers/unord/unord.set/contains.transparent.pass.cpp b/libcxx/test/std/containers/unord/unord.set/contains.transparent.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/containers/unord/unord.set/contains.transparent.pass.cpp @@ -0,0 +1,61 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// template , class Pred = equal_to, +// class Alloc = allocator> +// class unordered_multiset + +// template +// bool contains(const K& x) const; + +// UNSUPPORTED: c++03, c++11, c++14, c++17 + +#include +#include "test_transparent_unordered.h" + +int main(int, char**) +{ + using key_type = StoredType; + + { + // Make sure conversions don't happen for transparent non-final hasher and key_equal + using set_type = const unord_set_type >; + test_transparent_contains(key_type(1), key_type(2)); + } + + { + // Make sure conversions don't happen for transparent final hasher and key_equal + using set_type = const unord_set_type; + test_transparent_contains(key_type(1), key_type(2)); + } + + { + // Make sure conversions do happen for non-transparent hasher + using set_type = const unord_set_type >; + test_non_transparent_contains(key_type(1), key_type(2)); + } + + { + // Make sure conversions do happen for non-transparent key_equal + using set_type = const unord_set_type >; + test_non_transparent_contains(key_type(1), key_type(2)); + } + + { + // Make sure conversions do happen for both non-transparent hasher and key_equal + using set_type = const unord_set_type >; + test_non_transparent_contains(key_type(1), key_type(2)); + } + + return 0; +} diff --git a/libcxx/test/std/containers/unord/unord.set/count.transparent.pass.cpp b/libcxx/test/std/containers/unord/unord.set/count.transparent.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/containers/unord/unord.set/count.transparent.pass.cpp @@ -0,0 +1,62 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// template , class Pred = equal_to, +// class Alloc = allocator>> +// class unordered_set + +// template +// size_type count(const K& k) const; + +// UNSUPPORTED: c++03, c++11, c++14, c++17 + +#include + +#include "test_transparent_unordered.h" + +int main(int, char**) +{ + using key_type = StoredType; + + { + // Make sure conversions don't happen for transparent non-final hasher and key_equal + using set_type = const unord_set_type >; + test_transparent_count(key_type{1}, key_type{2}); + } + + { + // Make sure conversions don't happen for transparent final hasher and key_equal + using set_type = + const unord_set_type; + test_transparent_count(key_type{1}, key_type{2}); + } + + { + // Make sure conversions do happen for non-transparent hasher + using set_type = const unord_set_type >; + test_non_transparent_count(key_type{1}, key_type{2}); + } + + { + // Make sure conversions do happen for non-transparent key_equal + using set_type = + const unord_set_type >; + test_non_transparent_count(key_type{1}, key_type{2}); + } + + { + // Make sure conversions do happen for both non-transparent hasher and key_equal + using set_type = + const unord_set_type >; + test_non_transparent_count(key_type{1}, key_type{2}); + } + + return 0; +} diff --git a/libcxx/test/std/containers/unord/unord.set/equal_range_const.transparent.pass.cpp b/libcxx/test/std/containers/unord/unord.set/equal_range_const.transparent.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/containers/unord/unord.set/equal_range_const.transparent.pass.cpp @@ -0,0 +1,64 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// template , class Pred = equal_to, +// class Alloc = allocator>> +// class unordered_set + +// template +// pair equal_range(const K& k) const; + +// UNSUPPORTED: c++03, c++11, c++14, c++17 + +#include + +#include "test_transparent_unordered.h" + +int main(int, char**) +{ + using key_type = StoredType; + + { + // Make sure conversions don't happen for transparent non-final hasher and key_equal + using set_type = const unord_set_type >; + test_transparent_equal_range(key_type{1}, key_type{2}); + } + + { + // Make sure conversions don't happen for transparent final hasher and key_equal + using set_type = const unord_set_type; + test_transparent_equal_range(key_type{1}, key_type{2}); + } + + { + // Make sure conversions do happen for non-transparent hasher + using set_type = const unord_set_type >; + test_non_transparent_equal_range(key_type{1}, key_type{2}); + } + + { + // Make sure conversions do happen for non-transparent key_equal + using set_type = const unord_set_type >; + test_non_transparent_equal_range(key_type{1}, key_type{2}); + } + + { + // Make sure conversions do happen for both non-transparent hasher and key_equal + using set_type = const unord_set_type >; + test_non_transparent_equal_range(key_type{1}, key_type{2}); + } + + return 0; +} diff --git a/libcxx/test/std/containers/unord/unord.set/equal_range_non_const.transparent.pass.cpp b/libcxx/test/std/containers/unord/unord.set/equal_range_non_const.transparent.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/containers/unord/unord.set/equal_range_non_const.transparent.pass.cpp @@ -0,0 +1,64 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// template , class Pred = equal_to, +// class Alloc = allocator>> +// class unordered_set + +// template +// pair equal_range(const K& k); + +// UNSUPPORTED: c++03, c++11, c++14, c++17 + +#include + +#include "test_transparent_unordered.h" + +int main(int, char**) +{ + using key_type = StoredType; + + { + // Make sure conversions don't happen for transparent non-final hasher and key_equal + using set_type = unord_set_type >; + test_transparent_equal_range(key_type{1}, key_type{2}); + } + + { + // Make sure conversions don't happen for transparent final hasher and key_equal + using set_type = unord_set_type; + test_transparent_equal_range(key_type{1}, key_type{2}); + } + + { + // Make sure conversions do happen for non-transparent hasher + using set_type = unord_set_type >; + test_non_transparent_equal_range(key_type{1}, key_type{2}); + } + + { + // Make sure conversions do happen for non-transparent key_equal + using set_type = unord_set_type >; + test_non_transparent_equal_range(key_type{1}, key_type{2}); + } + + { + // Make sure conversions do happen for both non-transparent hasher and key_equal + using set_type = unord_set_type >; + test_non_transparent_equal_range(key_type{1}, key_type{2}); + } + + return 0; +} diff --git a/libcxx/test/std/containers/unord/unord.set/find_const.transparent.pass.cpp b/libcxx/test/std/containers/unord/unord.set/find_const.transparent.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/containers/unord/unord.set/find_const.transparent.pass.cpp @@ -0,0 +1,64 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// template , class Pred = equal_to, +// class Alloc = allocator>> +// class unordered_set + +// template +// const_iterator find(const K& k) const; + +// UNSUPPORTED: c++03, c++11, c++14, c++17 + +#include + +#include "test_transparent_unordered.h" + +int main(int, char**) +{ + using key_type = StoredType; + + { + // Make sure conversions don't happen for transparent non-final hasher and key_equal + using set_type = const unord_set_type >; + test_transparent_find(key_type{1}, key_type{2}); + } + + { + // Make sure conversions don't happen for transparent final hasher and key_equal + using set_type = const unord_set_type; + test_transparent_find(key_type{1}, key_type{2}); + } + + { + // Make sure conversions do happen for non-transparent hasher + using set_type = const unord_set_type >; + test_non_transparent_find(key_type{1}, key_type{2}); + } + + { + // Make sure conversions do happen for non-transparent key_equal + using set_type = const unord_set_type >; + test_non_transparent_find(key_type{1}, key_type{2}); + } + + { + // Make sure conversions do happen for both non-transparent hasher and key_equal + using set_type = const unord_set_type >; + test_non_transparent_find(key_type{1}, key_type{2}); + } + + return 0; +} diff --git a/libcxx/test/std/containers/unord/unord.set/find_non_const.transparent.pass.cpp b/libcxx/test/std/containers/unord/unord.set/find_non_const.transparent.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/containers/unord/unord.set/find_non_const.transparent.pass.cpp @@ -0,0 +1,64 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// template , class Pred = equal_to, +// class Alloc = allocator>> +// class unordered_set + +// template +// iterator find(const K& k); + +// UNSUPPORTED: c++03, c++11, c++14, c++17 + +#include + +#include "test_transparent_unordered.h" + +int main(int, char**) +{ + using key_type = StoredType; + + { + // Make sure conversions don't happen for transparent non-final hasher and key_equal + using set_type = unord_set_type >; + test_transparent_find(key_type{1}, key_type{2}); + } + + { + // Make sure conversions don't happen for transparent final hasher and key_equal + using set_type = unord_set_type; + test_transparent_find(key_type{1}, key_type{2}); + } + + { + // Make sure conversions do happen for non-transparent hasher + using set_type = unord_set_type >; + test_non_transparent_find(key_type{1}, key_type{2}); + } + + { + // Make sure conversions do happen for non-transparent key_equal + using set_type = unord_set_type >; + test_non_transparent_find(key_type{1}, key_type{2}); + } + + { + // Make sure conversions do happen for both non-transparent hasher and key_equal + using set_type = unord_set_type >; + test_non_transparent_find(key_type{1}, key_type{2}); + } + + return 0; +} diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/unordered_map.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/unordered_map.version.pass.cpp --- a/libcxx/test/std/language.support/support.limits/support.limits.general/unordered_map.version.pass.cpp +++ b/libcxx/test/std/language.support/support.limits/support.limits.general/unordered_map.version.pass.cpp @@ -131,17 +131,11 @@ # error "__cpp_lib_erase_if should have the value 202002L in c++2a" # endif -# if !defined(_LIBCPP_VERSION) -# ifndef __cpp_lib_generic_unordered_lookup -# error "__cpp_lib_generic_unordered_lookup should be defined in c++2a" -# endif -# if __cpp_lib_generic_unordered_lookup != 201811L -# error "__cpp_lib_generic_unordered_lookup should have the value 201811L in c++2a" -# endif -# else // _LIBCPP_VERSION -# ifdef __cpp_lib_generic_unordered_lookup -# error "__cpp_lib_generic_unordered_lookup should not be defined because it is unimplemented in libc++!" -# endif +# ifndef __cpp_lib_generic_unordered_lookup +# error "__cpp_lib_generic_unordered_lookup should be defined in c++2a" +# endif +# if __cpp_lib_generic_unordered_lookup != 201811L +# error "__cpp_lib_generic_unordered_lookup should have the value 201811L in c++2a" # endif # ifndef __cpp_lib_node_extract diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/unordered_set.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/unordered_set.version.pass.cpp --- a/libcxx/test/std/language.support/support.limits/support.limits.general/unordered_set.version.pass.cpp +++ b/libcxx/test/std/language.support/support.limits/support.limits.general/unordered_set.version.pass.cpp @@ -115,17 +115,11 @@ # error "__cpp_lib_erase_if should have the value 202002L in c++2a" # endif -# if !defined(_LIBCPP_VERSION) -# ifndef __cpp_lib_generic_unordered_lookup -# error "__cpp_lib_generic_unordered_lookup should be defined in c++2a" -# endif -# if __cpp_lib_generic_unordered_lookup != 201811L -# error "__cpp_lib_generic_unordered_lookup should have the value 201811L in c++2a" -# endif -# else // _LIBCPP_VERSION -# ifdef __cpp_lib_generic_unordered_lookup -# error "__cpp_lib_generic_unordered_lookup should not be defined because it is unimplemented in libc++!" -# endif +# ifndef __cpp_lib_generic_unordered_lookup +# error "__cpp_lib_generic_unordered_lookup should be defined in c++2a" +# endif +# if __cpp_lib_generic_unordered_lookup != 201811L +# error "__cpp_lib_generic_unordered_lookup should have the value 201811L in c++2a" # endif # ifndef __cpp_lib_node_extract diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp --- a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp +++ b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp @@ -1992,17 +1992,11 @@ # error "__cpp_lib_generic_associative_lookup should have the value 201304L in c++2a" # endif -# if !defined(_LIBCPP_VERSION) -# ifndef __cpp_lib_generic_unordered_lookup -# error "__cpp_lib_generic_unordered_lookup should be defined in c++2a" -# endif -# if __cpp_lib_generic_unordered_lookup != 201811L -# error "__cpp_lib_generic_unordered_lookup should have the value 201811L in c++2a" -# endif -# else // _LIBCPP_VERSION -# ifdef __cpp_lib_generic_unordered_lookup -# error "__cpp_lib_generic_unordered_lookup should not be defined because it is unimplemented in libc++!" -# endif +# ifndef __cpp_lib_generic_unordered_lookup +# error "__cpp_lib_generic_unordered_lookup should be defined in c++2a" +# endif +# if __cpp_lib_generic_unordered_lookup != 201811L +# error "__cpp_lib_generic_unordered_lookup should have the value 201811L in c++2a" # endif # if !defined(_LIBCPP_VERSION) diff --git a/libcxx/test/support/is_transparent.h b/libcxx/test/support/is_transparent.h --- a/libcxx/test/support/is_transparent.h +++ b/libcxx/test/support/is_transparent.h @@ -11,6 +11,8 @@ #include "test_macros.h" +#include // for std::equal_to + // testing transparent #if TEST_STD_VER > 11 @@ -79,6 +81,87 @@ bool operator <(const C2Int& rhs, const C2Int& lhs) { return rhs.get() < lhs.get(); } bool operator <(const C2Int& rhs, int lhs) { return rhs.get() < lhs; } -#endif +#endif // TEST_STD_VER > 11 + +#if TEST_STD_VER > 17 + +template +struct StoredType; + +template +struct SearchedType; + +struct hash_impl { + template + constexpr std::size_t operator()(SearchedType const& t) const { + return static_cast(t.get_value()); + } + + template + constexpr std::size_t operator()(StoredType const& t) const { + return static_cast(t.get_value()); + } +}; + +struct non_transparent_hash : hash_impl {}; + +struct transparent_hash : hash_impl { + using is_transparent = void; +}; + +struct transparent_hash_final final : transparent_hash {}; + +struct transparent_equal_final final : std::equal_to<> {}; + +template +struct SearchedType { + SearchedType(T value, int* counter) : value_(value), conversions_(counter) { } + + // Whenever a conversion is performed, increment the counter to keep track + // of conversions. + operator StoredType() const { + ++*conversions_; + return StoredType{value_}; + } + + int get_value() const { + return value_; + } + +private: + T value_; + int* conversions_; +}; + +template +struct StoredType { + StoredType() = default; + StoredType(T value) : value_(value) { } + + friend bool operator==(StoredType const& lhs, StoredType const& rhs) { + return lhs.value_ == rhs.value_; + } + + // If we're being passed a SearchedType object, avoid the conversion + // to T. This allows testing that the transparent operations are correctly + // forwarding the SearchedType all the way to this comparison by checking + // that we didn't have a conversion when we search for a SearchedType + // in a container full of StoredType. + friend bool operator==(StoredType const& lhs, SearchedType const& rhs) { + return lhs.value_ == rhs.get_value(); + } + friend bool operator==(SearchedType const& lhs, StoredType const& rhs) { + return lhs.get_value() == rhs.value_; + } + + int get_value() const { + return value_; + } + +private: + T value_; +}; + +#endif // TEST_STD_VER > 17 #endif // TRANSPARENT_H diff --git a/libcxx/test/support/test_transparent_unordered.h b/libcxx/test/support/test_transparent_unordered.h new file mode 100644 --- /dev/null +++ b/libcxx/test/support/test_transparent_unordered.h @@ -0,0 +1,136 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef TEST_TRANSPARENT_UNORDERED_H +#define TEST_TRANSPARENT_UNORDERED_H + +#include "test_macros.h" +#include "is_transparent.h" + +#include + +// testing transparent unordered containers +#if TEST_STD_VER > 17 + +template