[libcxx-commits] [libcxx] d5db71d - [libc++] [P0919] Some belated review on D87171.
Arthur O'Dwyer via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Sep 20 11:48:31 PDT 2021
Author: Arthur O'Dwyer
Date: 2021-09-20T14:46:38-04:00
New Revision: d5db71d19f11d7c31257066aea6bd41ef04f28b7
URL: https://github.com/llvm/llvm-project/commit/d5db71d19f11d7c31257066aea6bd41ef04f28b7
DIFF: https://github.com/llvm/llvm-project/commit/d5db71d19f11d7c31257066aea6bd41ef04f28b7.diff
LOG: [libc++] [P0919] Some belated review on D87171.
- Simplify the structure of the new tests.
- Test const containers as well as non-const containers,
since it's easy to do so.
- Remove redundant enable-iffing of helper structs' member functions.
(They're not instantiated unless they're called, and who would call them?)
- Fix indentation and use more consistent SFINAE method in <unordered_map>.
- Add _LIBCPP_INLINE_VISIBILITY on some swap functions.
Differential Revision: https://reviews.llvm.org/D109011
Added:
libcxx/test/std/containers/unord/unord.map/equal_range.transparent.pass.cpp
libcxx/test/std/containers/unord/unord.map/find.transparent.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/equal_range.transparent.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/find.transparent.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/equal_range.transparent.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/find.transparent.pass.cpp
libcxx/test/std/containers/unord/unord.set/equal_range.transparent.pass.cpp
libcxx/test/std/containers/unord/unord.set/find.transparent.pass.cpp
Modified:
libcxx/include/map
libcxx/include/unordered_map
libcxx/include/unordered_set
libcxx/test/std/containers/unord/unord.map/contains.transparent.pass.cpp
libcxx/test/std/containers/unord/unord.map/count.transparent.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/contains.transparent.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/count.transparent.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/contains.transparent.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/count.transparent.pass.cpp
libcxx/test/std/containers/unord/unord.set/contains.transparent.pass.cpp
libcxx/test/std/containers/unord/unord.set/count.transparent.pass.cpp
libcxx/test/support/is_transparent.h
libcxx/test/support/test_transparent_unordered.h
Removed:
libcxx/test/std/containers/unord/unord.map/equal_range_const.transparent.pass.cpp
libcxx/test/std/containers/unord/unord.map/equal_range_non_const.transparent.pass.cpp
libcxx/test/std/containers/unord/unord.map/find_const.transparent.pass.cpp
libcxx/test/std/containers/unord/unord.map/find_non_const.transparent.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/equal_range_const.transparent.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/equal_range_non_const.transparent.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/find_const.transparent.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/find_non_const.transparent.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/equal_range_const.transparent.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/equal_range_non_const.transparent.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/find_const.transparent.pass.cpp
libcxx/test/std/containers/unord/unord.multiset/find_non_const.transparent.pass.cpp
libcxx/test/std/containers/unord/unord.set/equal_range_const.transparent.pass.cpp
libcxx/test/std/containers/unord/unord.set/equal_range_non_const.transparent.pass.cpp
libcxx/test/std/containers/unord/unord.set/find_const.transparent.pass.cpp
libcxx/test/std/containers/unord/unord.set/find_non_const.transparent.pass.cpp
################################################################################
diff --git a/libcxx/include/map b/libcxx/include/map
index 3cca20511fd20..25b75af377b0d 100644
--- a/libcxx/include/map
+++ b/libcxx/include/map
@@ -545,15 +545,13 @@ public:
#if _LIBCPP_STD_VER > 11
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
- typename enable_if<__is_transparent<_Compare, _K2>::value, bool>::type
- operator () ( const _K2& __x, const _CP& __y ) const
- {return static_cast<const _Compare&>(*this) (__x, __y.__get_value().first);}
+ bool operator()(const _K2& __x, const _CP& __y) const
+ {return static_cast<const _Compare&>(*this)(__x, __y.__get_value().first);}
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
- typename enable_if<__is_transparent<_Compare, _K2>::value, bool>::type
- operator () (const _CP& __x, const _K2& __y) const
- {return static_cast<const _Compare&>(*this) (__x.__get_value().first, __y);}
+ bool operator()(const _CP& __x, const _K2& __y) const
+ {return static_cast<const _Compare&>(*this)(__x.__get_value().first, __y);}
#endif
};
@@ -593,15 +591,13 @@ public:
#if _LIBCPP_STD_VER > 11
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
- typename enable_if<__is_transparent<_Compare, _K2>::value, bool>::type
- operator () ( const _K2& __x, const _CP& __y ) const
- {return comp (__x, __y.__get_value().first);}
+ bool operator()(const _K2& __x, const _CP& __y) const
+ {return comp(__x, __y.__get_value().first);}
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
- typename enable_if<__is_transparent<_Compare, _K2>::value, bool>::type
- operator () (const _CP& __x, const _K2& __y) const
- {return comp (__x.__get_value().first, __y);}
+ bool operator()(const _CP& __x, const _K2& __y) const
+ {return comp(__x.__get_value().first, __y);}
#endif
};
diff --git a/libcxx/include/unordered_map b/libcxx/include/unordered_map
index c53fb18910f49..a420c53f65fe1 100644
--- a/libcxx/include/unordered_map
+++ b/libcxx/include/unordered_map
@@ -473,11 +473,12 @@ public:
size_t operator()(const _Key& __x) const
{return static_cast<const _Hash&>(*this)(__x);}
#if _LIBCPP_STD_VER > 17
- template <typename _K2, typename = enable_if_t<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>>
+ template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
size_t operator()(const _K2& __x) const
{return static_cast<const _Hash&>(*this)(__x);}
#endif
+ _LIBCPP_INLINE_VISIBILITY
void swap(__unordered_map_hasher& __y)
_NOEXCEPT_(__is_nothrow_swappable<_Hash>::value)
{
@@ -508,11 +509,12 @@ public:
size_t operator()(const _Key& __x) const
{return __hash_(__x);}
#if _LIBCPP_STD_VER > 17
- template <typename _K2, typename = enable_if_t<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>>
+ template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
size_t operator()(const _K2& __x) const
{return __hash_(__x);}
#endif
+ _LIBCPP_INLINE_VISIBILITY
void swap(__unordered_map_hasher& __y)
_NOEXCEPT_(__is_nothrow_swappable<_Hash>::value)
{
@@ -557,23 +559,24 @@ public:
bool operator()(const _Key& __x, const _Cp& __y) const
{return static_cast<const _Pred&>(*this)(__x, __y.__get_value().first);}
#if _LIBCPP_STD_VER > 17
- template <typename _K2, typename = enable_if_t<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>>
+ template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Cp& __x, const _K2& __y) const
{return static_cast<const _Pred&>(*this)(__x.__get_value().first, __y);}
- template <typename _K2, typename = enable_if_t<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>>
+ template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _K2& __x, const _Cp& __y) const
{return static_cast<const _Pred&>(*this)(__x, __y.__get_value().first);}
- template <typename _K2, typename = enable_if_t<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>>
+ template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Key& __x, const _K2& __y) const
{return static_cast<const _Pred&>(*this)(__x, __y);}
- template <typename _K2, typename = enable_if_t<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>>
+ template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _K2& __x, const _Key& __y) const
{return static_cast<const _Pred&>(*this)(__x, __y);}
#endif
+ _LIBCPP_INLINE_VISIBILITY
void swap(__unordered_map_equal& __y)
_NOEXCEPT_(__is_nothrow_swappable<_Pred>::value)
{
@@ -607,23 +610,24 @@ public:
bool operator()(const _Key& __x, const _Cp& __y) const
{return __pred_(__x, __y.__get_value().first);}
#if _LIBCPP_STD_VER > 17
- template <typename _K2, typename = enable_if_t<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>>
+ template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Cp& __x, const _K2& __y) const
{return __pred_(__x.__get_value().first, __y);}
- template <typename _K2, typename = enable_if_t<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>>
+ template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _K2& __x, const _Cp& __y) const
{return __pred_(__x, __y.__get_value().first);}
- template <typename _K2, typename = enable_if_t<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>>
+ template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Key& __x, const _K2& __y) const
{return __pred_(__x, __y);}
- template <typename _K2, typename = enable_if_t<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>>
+ template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _K2& __x, const _Key& __y) const
{return __pred_(__x, __y);}
#endif
+ _LIBCPP_INLINE_VISIBILITY
void swap(__unordered_map_equal& __y)
_NOEXCEPT_(__is_nothrow_swappable<_Pred>::value)
{
@@ -1355,51 +1359,48 @@ public:
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 <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, iterator>
- find(const _K2& __k) {return __table_.find(__k);}
- template <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, const_iterator>
- find(const _K2& __k) const {return __table_.find(__k);}
- #endif // _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER > 17
+ template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_INLINE_VISIBILITY
+ iterator find(const _K2& __k) {return __table_.find(__k);}
+ template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_INLINE_VISIBILITY
+ 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 <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::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();}
+#if _LIBCPP_STD_VER > 17
+ template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_INLINE_VISIBILITY
+ 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 <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_INLINE_VISIBILITY
+ bool contains(const _K2& __k) const {return find(__k) != end();}
+#endif // _LIBCPP_STD_VER > 17
- template <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, bool>
- contains(const _K2& __k) const {return find(__k) != end();}
- #endif // _LIBCPP_STD_VER > 17
_LIBCPP_INLINE_VISIBILITY
pair<iterator, iterator> equal_range(const key_type& __k)
{return __table_.__equal_range_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
{return __table_.__equal_range_unique(__k);}
- #if _LIBCPP_STD_VER > 17
- template <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, pair<iterator, iterator>>
- equal_range(const _K2& __k) {return __table_.__equal_range_unique(__k);}
- template <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, pair<const_iterator, const_iterator>>
- equal_range(const _K2& __k) const {return __table_.__equal_range_unique(__k);}
- #endif // _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER > 17
+ template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_INLINE_VISIBILITY
+ pair<iterator, iterator> equal_range(const _K2& __k)
+ {return __table_.__equal_range_unique(__k);}
+ template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_INLINE_VISIBILITY
+ pair<const_iterator, const_iterator> 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
@@ -2167,49 +2168,48 @@ public:
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 <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, iterator>
- find(const _K2& __k) {return __table_.find(__k);}
- template <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, const_iterator>
- find(const _K2& __k) const {return __table_.find(__k);}
- #endif // _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER > 17
+ template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_INLINE_VISIBILITY
+ iterator find(const _K2& __k) {return __table_.find(__k);}
+ template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_INLINE_VISIBILITY
+ 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 <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::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();}
+#if _LIBCPP_STD_VER > 17
+ template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_INLINE_VISIBILITY
+ 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 <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_INLINE_VISIBILITY
+ bool contains(const _K2& __k) const {return find(__k) != end();}
+#endif // _LIBCPP_STD_VER > 17
- template <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, bool>
- contains(const _K2& __k) const {return find(__k) != end();}
- #endif // _LIBCPP_STD_VER > 17
_LIBCPP_INLINE_VISIBILITY
pair<iterator, iterator> equal_range(const key_type& __k)
{return __table_.__equal_range_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
{return __table_.__equal_range_multi(__k);}
- #if _LIBCPP_STD_VER > 17
- template <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, pair<iterator, iterator>>
- equal_range(const _K2& __k) {return __table_.__equal_range_multi(__k);}
- template <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, pair<const_iterator, const_iterator>>
- equal_range(const _K2& __k) const {return __table_.__equal_range_multi(__k);}
- #endif // _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER > 17
+ template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_INLINE_VISIBILITY
+ pair<iterator, iterator> equal_range(const _K2& __k)
+ {return __table_.__equal_range_multi(__k);}
+ template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_INLINE_VISIBILITY
+ pair<const_iterator, const_iterator> 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
index 0bac48a2422e0..5856e4bc40108 100644
--- a/libcxx/include/unordered_set
+++ b/libcxx/include/unordered_set
@@ -706,49 +706,48 @@ public:
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 <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, iterator>
- find(const _K2& __k) {return __table_.find(__k);}
- template <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, const_iterator>
- find(const _K2& __k) const {return __table_.find(__k);}
- #endif // _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER > 17
+ template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_INLINE_VISIBILITY
+ iterator find(const _K2& __k) {return __table_.find(__k);}
+ template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_INLINE_VISIBILITY
+ 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 <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::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();}
+#if _LIBCPP_STD_VER > 17
+ template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_INLINE_VISIBILITY
+ 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 <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_INLINE_VISIBILITY
+ bool contains(const _K2& __k) const {return find(__k) != end();}
+#endif // _LIBCPP_STD_VER > 17
- template <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, bool>
- contains(const _K2& __k) const {return find(__k) != end();}
- #endif // _LIBCPP_STD_VER > 17
_LIBCPP_INLINE_VISIBILITY
pair<iterator, iterator> equal_range(const key_type& __k)
{return __table_.__equal_range_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
{return __table_.__equal_range_unique(__k);}
- #if _LIBCPP_STD_VER > 17
- template <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, pair<iterator, iterator>>
- equal_range(const _K2& __k) {return __table_.__equal_range_unique(__k);}
- template <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, pair<const_iterator, const_iterator>>
- equal_range(const _K2& __k) const {return __table_.__equal_range_unique(__k);}
- #endif // _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER > 17
+ template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_INLINE_VISIBILITY
+ pair<iterator, iterator> equal_range(const _K2& __k)
+ {return __table_.__equal_range_unique(__k);}
+ template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_INLINE_VISIBILITY
+ pair<const_iterator, const_iterator> 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();}
@@ -1372,49 +1371,48 @@ public:
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 <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, iterator>
- find(const _K2& __k) {return __table_.find(__k);}
- template <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, const_iterator>
- find(const _K2& __k) const {return __table_.find(__k);}
- #endif // _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER > 17
+ template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_INLINE_VISIBILITY
+ iterator find(const _K2& __k) {return __table_.find(__k);}
+ template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_INLINE_VISIBILITY
+ 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 <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::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();}
+#if _LIBCPP_STD_VER > 17
+ template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_INLINE_VISIBILITY
+ 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<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_INLINE_VISIBILITY
+ bool contains(const _K2& __k) const {return find(__k) != end();}
+#endif // _LIBCPP_STD_VER > 17
- template <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, bool>
- contains(const _K2& __k) const {return find(__k) != end();}
- #endif // _LIBCPP_STD_VER > 17
_LIBCPP_INLINE_VISIBILITY
pair<iterator, iterator> equal_range(const key_type& __k)
{return __table_.__equal_range_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
{return __table_.__equal_range_multi(__k);}
- #if _LIBCPP_STD_VER > 17
- template <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, pair<iterator, iterator>>
- equal_range(const _K2& __k) {return __table_.__equal_range_multi(__k);}
- template <typename _K2>
- _LIBCPP_INLINE_VISIBILITY
- enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, pair<const_iterator, const_iterator>>
- equal_range(const _K2& __k) const {return __table_.__equal_range_multi(__k);}
- #endif // _LIBCPP_STD_VER > 17
+#if _LIBCPP_STD_VER > 17
+ template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_INLINE_VISIBILITY
+ pair<iterator, iterator> equal_range(const _K2& __k)
+ {return __table_.__equal_range_multi(__k);}
+ template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr>
+ _LIBCPP_INLINE_VISIBILITY
+ pair<const_iterator, const_iterator> 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/test/std/containers/unord/unord.map/contains.transparent.pass.cpp b/libcxx/test/std/containers/unord/unord.map/contains.transparent.pass.cpp
index 5d3b5cecfbdff..b8742cdb4b6c4 100644
--- a/libcxx/test/std/containers/unord/unord.map/contains.transparent.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/contains.transparent.pass.cpp
@@ -23,39 +23,40 @@
int main(int, char**)
{
using key_type = StoredType<int>;
- using ilist_type = std::initializer_list<std::pair<const key_type, int> >;
{
// Make sure conversions don't happen for transparent non-final hasher and key_equal
- using map_type = const unord_map_type<std::unordered_map, transparent_hash, std::equal_to<> >;
- test_transparent_contains<map_type>(ilist_type{{1, 2}, {2, 3}});
+ using M = unord_map_type<std::unordered_map, transparent_hash, std::equal_to<>>;
+ test_transparent_contains<M>({{1, 2}, {2, 3}});
+ test_transparent_contains<const M>({{1, 2}, {2, 3}});
}
{
// Make sure conversions don't happen for transparent final hasher and key_equal
- using map_type = const unord_map_type<std::unordered_map, transparent_hash_final, transparent_equal_final>;
- test_transparent_contains<map_type>(ilist_type{{1, 2}, {2, 3}});
+ using M = unord_map_type<std::unordered_map, transparent_hash_final, transparent_equal_final>;
+ test_transparent_contains<M>({{1, 2}, {2, 3}});
+ test_transparent_contains<const M>({{1, 2}, {2, 3}});
}
{
// Make sure conversions do happen for non-transparent hasher
- using map_type = const unord_map_type<std::unordered_map, non_transparent_hash,
- std::equal_to<> >;
- test_non_transparent_contains<map_type>(ilist_type{{1, 2}, {2, 3}});
+ using M = unord_map_type<std::unordered_map, non_transparent_hash, std::equal_to<>>;
+ test_non_transparent_contains<M>({{1, 2}, {2, 3}});
+ test_non_transparent_contains<const M>({{1, 2}, {2, 3}});
}
{
// Make sure conversions do happen for non-transparent key_equal
- using map_type = const unord_map_type<std::unordered_map, transparent_hash,
- std::equal_to<key_type> >;
- test_non_transparent_contains<map_type>(ilist_type{{1, 2}, {2, 3}});
+ using M = unord_map_type<std::unordered_map, transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_contains<M>({{1, 2}, {2, 3}});
+ test_non_transparent_contains<const M>({{1, 2}, {2, 3}});
}
{
// Make sure conversions do happen for both non-transparent hasher and key_equal
- using map_type = const unord_map_type<std::unordered_map, non_transparent_hash,
- std::equal_to<key_type> >;
- test_non_transparent_contains<map_type>(ilist_type{{1, 2}, {2, 3}});
+ using M = unord_map_type<std::unordered_map, non_transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_contains<M>({{1, 2}, {2, 3}});
+ test_non_transparent_contains<const M>({{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
index 07276c25fe7cb..1ae5a94d256a5 100644
--- a/libcxx/test/std/containers/unord/unord.map/count.transparent.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/count.transparent.pass.cpp
@@ -24,39 +24,40 @@
int main(int, char**)
{
using key_type = StoredType<int>;
- using ilist_type = std::initializer_list<std::pair<const key_type, int> >;
{
// Make sure conversions don't happen for transparent non-final hasher and key_equal
- using map_type = const unord_map_type<std::unordered_map, transparent_hash, std::equal_to<> >;
- test_transparent_count<map_type>(ilist_type{{1, 2}, {2, 3}});
+ using M = unord_map_type<std::unordered_map, transparent_hash, std::equal_to<>>;
+ test_transparent_count<M>({{1, 2}, {2, 3}});
+ test_transparent_count<const M>({{1, 2}, {2, 3}});
}
{
// Make sure conversions don't happen for transparent final hasher and key_equal
- using map_type =
- const unord_map_type<std::unordered_map, transparent_hash_final, transparent_equal_final>;
- test_transparent_count<map_type>(ilist_type{{1, 2}, {2, 3}});
+ using M = unord_map_type<std::unordered_map, transparent_hash_final, transparent_equal_final>;
+ test_transparent_count<M>({{1, 2}, {2, 3}});
+ test_transparent_count<const M>({{1, 2}, {2, 3}});
}
{
// Make sure conversions do happen for non-transparent hasher
- using map_type = const unord_map_type<std::unordered_map, non_transparent_hash, std::equal_to<> >;
- test_non_transparent_count<map_type>(ilist_type{{1, 2}, {2, 3}});
+ using M = unord_map_type<std::unordered_map, non_transparent_hash, std::equal_to<>>;
+ test_non_transparent_count<M>({{1, 2}, {2, 3}});
+ test_non_transparent_count<const M>({{1, 2}, {2, 3}});
}
{
// Make sure conversions do happen for non-transparent key_equal
- using map_type =
- const unord_map_type<std::unordered_map, transparent_hash, std::equal_to<key_type> >;
- test_non_transparent_count<map_type>(ilist_type{{1, 2}, {2, 3}});
+ using M = unord_map_type<std::unordered_map, transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_count<M>({{1, 2}, {2, 3}});
+ test_non_transparent_count<const M>({{1, 2}, {2, 3}});
}
{
// Make sure conversions do happen for both non-transparent hasher and key_equal
- using map_type =
- const unord_map_type<std::unordered_map, non_transparent_hash, std::equal_to<key_type> >;
- test_non_transparent_count<map_type>(ilist_type{{1, 2}, {2, 3}});
+ using M = unord_map_type<std::unordered_map, non_transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_count<M>({{1, 2}, {2, 3}});
+ test_non_transparent_count<const M>({{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.transparent.pass.cpp
similarity index 53%
rename from libcxx/test/std/containers/unord/unord.map/equal_range_non_const.transparent.pass.cpp
rename to libcxx/test/std/containers/unord/unord.map/equal_range.transparent.pass.cpp
index 97db1dcecc1e6..07b34f3110e3e 100644
--- 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.transparent.pass.cpp
@@ -24,41 +24,40 @@
int main(int, char**)
{
using key_type = StoredType<int>;
- using ilist_type = std::initializer_list<std::pair<const key_type, int> >;
{
// Make sure conversions don't happen for transparent non-final hasher and key_equal
- using map_type = unord_map_type<std::unordered_map, transparent_hash,
- std::equal_to<> >;
- test_transparent_equal_range<map_type>(ilist_type{{1, 2}, {2, 3}});
+ using M = unord_map_type<std::unordered_map, transparent_hash, std::equal_to<>>;
+ test_transparent_equal_range<M>({{1, 2}, {2, 3}});
+ test_transparent_equal_range<const M>({{1, 2}, {2, 3}});
}
{
// Make sure conversions don't happen for transparent final hasher and key_equal
- using map_type = unord_map_type<std::unordered_map, transparent_hash_final,
- transparent_equal_final>;
- test_transparent_equal_range<map_type>(ilist_type{{1, 2}, {2, 3}});
+ using M = unord_map_type<std::unordered_map, transparent_hash_final, transparent_equal_final>;
+ test_transparent_equal_range<M>({{1, 2}, {2, 3}});
+ test_transparent_equal_range<const M>({{1, 2}, {2, 3}});
}
{
// Make sure conversions do happen for non-transparent hasher
- using map_type = unord_map_type<std::unordered_map, non_transparent_hash,
- std::equal_to<> >;
- test_non_transparent_equal_range<map_type>(ilist_type{{1, 2}, {2, 3}});
+ using M = unord_map_type<std::unordered_map, non_transparent_hash, std::equal_to<>>;
+ test_non_transparent_equal_range<M>({{1, 2}, {2, 3}});
+ test_non_transparent_equal_range<const M>({{1, 2}, {2, 3}});
}
{
// Make sure conversions do happen for non-transparent key_equal
- using map_type = unord_map_type<std::unordered_map, transparent_hash,
- std::equal_to<key_type> >;
- test_non_transparent_equal_range<map_type>(ilist_type{{1, 2}, {2, 3}});
+ using M = unord_map_type<std::unordered_map, transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_equal_range<M>({{1, 2}, {2, 3}});
+ test_non_transparent_equal_range<const M>({{1, 2}, {2, 3}});
}
{
// Make sure conversions do happen for both non-transparent hasher and key_equal
- using map_type = unord_map_type<std::unordered_map, non_transparent_hash,
- std::equal_to<key_type> >;
- test_non_transparent_equal_range<map_type>(ilist_type{{1, 2}, {2, 3}});
+ using M = unord_map_type<std::unordered_map, non_transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_equal_range<M>({{1, 2}, {2, 3}});
+ test_non_transparent_equal_range<const M>({{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
deleted file mode 100644
index 9e76f72081edb..0000000000000
--- a/libcxx/test/std/containers/unord/unord.map/equal_range_const.transparent.pass.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-
-// <unordered_map>
-
-// template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>,
-// class Alloc = allocator<pair<const Key, T>>>
-// class unordered_map
-
-// template <typename K>
-// pair<const_iterator, const_iterator> equal_range(const K& k) const;
-
-// UNSUPPORTED: c++03, c++11, c++14, c++17
-
-#include <unordered_map>
-
-#include "test_transparent_unordered.h"
-
-int main(int, char**)
-{
- using key_type = StoredType<int>;
- using ilist_type = std::initializer_list<std::pair<const key_type, int> >;
-
- {
- // Make sure conversions don't happen for transparent non-final hasher and key_equal
- using map_type = const unord_map_type<std::unordered_map, transparent_hash,
- std::equal_to<> >;
- test_transparent_equal_range<map_type>(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<std::unordered_map, transparent_hash_final,
- transparent_equal_final>;
- test_transparent_equal_range<map_type>(ilist_type{{1, 2}, {2, 3}});
- }
-
- {
- // Make sure conversions do happen for non-transparent hasher
- using map_type = const unord_map_type<std::unordered_map, non_transparent_hash,
- std::equal_to<> >;
- test_non_transparent_equal_range<map_type>(ilist_type{{1, 2}, {2, 3}});
- }
-
- {
- // Make sure conversions do happen for non-transparent key_equal
- using map_type = const unord_map_type<std::unordered_map, transparent_hash,
- std::equal_to<key_type> >;
- test_non_transparent_equal_range<map_type>(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<std::unordered_map, non_transparent_hash,
- std::equal_to<key_type> >;
- test_non_transparent_equal_range<map_type>(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.transparent.pass.cpp
similarity index 53%
rename from libcxx/test/std/containers/unord/unord.map/find_non_const.transparent.pass.cpp
rename to libcxx/test/std/containers/unord/unord.map/find.transparent.pass.cpp
index b4233a8333d11..623b86f6ab530 100644
--- a/libcxx/test/std/containers/unord/unord.map/find_non_const.transparent.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/find.transparent.pass.cpp
@@ -24,41 +24,40 @@
int main(int, char**)
{
using key_type = StoredType<int>;
- using ilist_type = std::initializer_list<std::pair<const key_type, int> >;
{
// Make sure conversions don't happen for transparent non-final hasher and key_equal
- using map_type = unord_map_type<std::unordered_map, transparent_hash,
- std::equal_to<> >;
- test_transparent_find<map_type>(ilist_type{{1, 2}, {2, 3}});
+ using M = unord_map_type<std::unordered_map, transparent_hash, std::equal_to<>>;
+ test_transparent_find<M>({{1, 2}, {2, 3}});
+ test_transparent_find<const M>({{1, 2}, {2, 3}});
}
{
// Make sure conversions don't happen for transparent final hasher and key_equal
- using map_type = unord_map_type<std::unordered_map, transparent_hash_final,
- transparent_equal_final>;
- test_transparent_find<map_type>(ilist_type{{1, 2}, {2, 3}});
+ using M = unord_map_type<std::unordered_map, transparent_hash_final, transparent_equal_final>;
+ test_transparent_find<M>({{1, 2}, {2, 3}});
+ test_transparent_find<const M>({{1, 2}, {2, 3}});
}
{
// Make sure conversions do happen for non-transparent hasher
- using map_type = unord_map_type<std::unordered_map, non_transparent_hash,
- std::equal_to<> >;
- test_non_transparent_find<map_type>(ilist_type{{1, 2}, {2, 3}});
+ using M = unord_map_type<std::unordered_map, non_transparent_hash, std::equal_to<>>;
+ test_non_transparent_find<M>({{1, 2}, {2, 3}});
+ test_non_transparent_find<const M>({{1, 2}, {2, 3}});
}
{
// Make sure conversions do happen for non-transparent key_equal
- using map_type = unord_map_type<std::unordered_map, transparent_hash,
- std::equal_to<key_type> >;
- test_non_transparent_find<map_type>(ilist_type{{1, 2}, {2, 3}});
+ using M = unord_map_type<std::unordered_map, transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_find<M>({{1, 2}, {2, 3}});
+ test_non_transparent_find<const M>({{1, 2}, {2, 3}});
}
{
// Make sure conversions do happen for both non-transparent hasher and key_equal
- using map_type = unord_map_type<std::unordered_map, non_transparent_hash,
- std::equal_to<key_type> >;
- test_non_transparent_find<map_type>(ilist_type{{1, 2}, {2, 3}});
+ using M = unord_map_type<std::unordered_map, non_transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_find<M>({{1, 2}, {2, 3}});
+ test_non_transparent_find<const M>({{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
deleted file mode 100644
index cc9324f281902..0000000000000
--- a/libcxx/test/std/containers/unord/unord.map/find_const.transparent.pass.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-
-// <unordered_map>
-
-// template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>,
-// class Alloc = allocator<pair<const Key, T>>>
-// class unordered_map
-
-// template <typename K>
-// const_iterator find(const K& k) const;
-
-// UNSUPPORTED: c++03, c++11, c++14, c++17
-
-#include <unordered_map>
-
-#include "test_transparent_unordered.h"
-
-int main(int, char**)
-{
- using key_type = StoredType<int>;
- using ilist_type = std::initializer_list<std::pair<const key_type, int> >;
-
- {
- // Make sure conversions don't happen for transparent non-final hasher and key_equal
- using map_type = const unord_map_type<std::unordered_map, transparent_hash,
- std::equal_to<> >;
- test_transparent_find<map_type>(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<std::unordered_map, transparent_hash_final,
- transparent_equal_final>;
- test_transparent_find<map_type>(ilist_type{{1, 2}, {2, 3}});
- }
-
- {
- // Make sure conversions do happen for non-transparent hasher
- using map_type = const unord_map_type<std::unordered_map, non_transparent_hash,
- std::equal_to<> >;
- test_non_transparent_find<map_type>(ilist_type{{1, 2}, {2, 3}});
- }
-
- {
- // Make sure conversions do happen for non-transparent key_equal
- using map_type = const unord_map_type<std::unordered_map, transparent_hash,
- std::equal_to<key_type> >;
- test_non_transparent_find<map_type>(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<std::unordered_map, non_transparent_hash,
- std::equal_to<key_type> >;
- test_non_transparent_find<map_type>(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
index 2f07bcd37fa0d..9ebf4f2aa5df9 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/contains.transparent.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/contains.transparent.pass.cpp
@@ -23,42 +23,40 @@
int main(int, char**)
{
using key_type = StoredType<int>;
- using ilist_type = std::initializer_list<std::pair<const key_type, int> >;
{
// Make sure conversions don't happen for transparent non-final hasher and key_equal
- using map_type = unord_map_type<std::unordered_multimap, transparent_hash,
- std::equal_to<> >;
- test_transparent_contains<map_type>(ilist_type{{1, 2}, {1, 3}, {2, 3}});
+ using M = unord_map_type<std::unordered_multimap, transparent_hash, std::equal_to<>>;
+ test_transparent_contains<M>({{1, 2}, {1, 3}, {2, 3}});
+ test_transparent_contains<const M>({{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<std::unordered_multimap, transparent_hash_final, transparent_equal_final>;
- test_transparent_contains<map_type>(ilist_type{{1, 2}, {1, 3}, {2, 3}});
+ using M = unord_map_type<std::unordered_multimap, transparent_hash_final, transparent_equal_final>;
+ test_transparent_contains<M>({{1, 2}, {1, 3}, {2, 3}});
+ test_transparent_contains<const M>({{1, 2}, {1, 3}, {2, 3}});
}
{
// Make sure conversions do happen for non-transparent hasher
- using map_type = unord_map_type<std::unordered_multimap, non_transparent_hash,
- std::equal_to<> >;
- test_non_transparent_contains<map_type>(ilist_type{{1, 2}, {1, 3}, {2, 3}});
+ using M = unord_map_type<std::unordered_multimap, non_transparent_hash, std::equal_to<>>;
+ test_non_transparent_contains<M>({{1, 2}, {1, 3}, {2, 3}});
+ test_non_transparent_contains<const M>({{1, 2}, {1, 3}, {2, 3}});
}
{
// Make sure conversions do happen for non-transparent key_equal
- using map_type = unord_map_type<std::unordered_multimap, transparent_hash,
- std::equal_to<key_type> >;
- test_non_transparent_contains<map_type>(
- ilist_type{{1, 2}, {1, 3}, {2, 3}});
+ using M = unord_map_type<std::unordered_multimap, transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_contains<M>({{1, 2}, {1, 3}, {2, 3}});
+ test_non_transparent_contains<const M>({{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<std::unordered_multimap, non_transparent_hash,
- std::equal_to<key_type> >;
- test_non_transparent_contains<map_type>(
- ilist_type{{1, 2}, {1, 3}, {2, 3}});
+ using M = unord_map_type<std::unordered_multimap, non_transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_contains<M>({{1, 2}, {1, 3}, {2, 3}});
+ test_non_transparent_contains<const M>({{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
index 7abf662982f6c..b9755cfdeaaf2 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/count.transparent.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/count.transparent.pass.cpp
@@ -24,39 +24,40 @@
int main(int, char**)
{
using key_type = StoredType<int>;
- using ilist_type = std::initializer_list<std::pair<const key_type, int> >;
{
// Make sure conversions don't happen for transparent non-final hasher and key_equal
- using map_type = const unord_map_type<std::unordered_multimap, transparent_hash, std::equal_to<> >;
- test_transparent_count<map_type>(ilist_type{{1, 2}, {1, 3}, {2, 3}});
+ using M = unord_map_type<std::unordered_multimap, transparent_hash, std::equal_to<>>;
+ test_transparent_count<M>({{1, 2}, {1, 3}, {2, 3}});
+ test_transparent_count<const M>({{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<std::unordered_multimap, transparent_hash_final, transparent_equal_final>;
- test_transparent_count<map_type>(ilist_type{{1, 2}, {1, 3}, {2, 3}});
+ using M = unord_map_type<std::unordered_multimap, transparent_hash_final, transparent_equal_final>;
+ test_transparent_count<M>({{1, 2}, {1, 3}, {2, 3}});
+ test_transparent_count<const M>({{1, 2}, {1, 3}, {2, 3}});
}
{
// Make sure conversions do happen for non-transparent hasher
- using map_type = const unord_map_type<std::unordered_multimap, non_transparent_hash, std::equal_to<> >;
- test_non_transparent_count<map_type>(ilist_type{{1, 2}, {1, 3}, {2, 3}});
+ using M = unord_map_type<std::unordered_multimap, non_transparent_hash, std::equal_to<>>;
+ test_non_transparent_count<M>({{1, 2}, {1, 3}, {2, 3}});
+ test_non_transparent_count<const M>({{1, 2}, {1, 3}, {2, 3}});
}
{
// Make sure conversions do happen for non-transparent key_equal
- using map_type =
- const unord_map_type<std::unordered_multimap, transparent_hash, std::equal_to<key_type> >;
- test_non_transparent_count<map_type>(ilist_type{{1, 2}, {1, 3}, {2, 3}});
+ using M = unord_map_type<std::unordered_multimap, transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_count<M>({{1, 2}, {1, 3}, {2, 3}});
+ test_non_transparent_count<const M>({{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<std::unordered_multimap, non_transparent_hash, std::equal_to<key_type> >;
- test_non_transparent_count<map_type>(ilist_type{{1, 2}, {1, 3}, {2, 3}});
+ using M = unord_map_type<std::unordered_multimap, non_transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_count<M>({{1, 2}, {1, 3}, {2, 3}});
+ test_non_transparent_count<const M>({{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.transparent.pass.cpp
similarity index 51%
rename from libcxx/test/std/containers/unord/unord.multimap/equal_range_non_const.transparent.pass.cpp
rename to libcxx/test/std/containers/unord/unord.multimap/equal_range.transparent.pass.cpp
index a4c7730fd85f2..85248e59d780e 100644
--- 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.transparent.pass.cpp
@@ -24,41 +24,40 @@
int main(int, char**)
{
using key_type = StoredType<int>;
- using ilist_type = std::initializer_list<std::pair<const key_type, int> >;
{
// Make sure conversions don't happen for transparent non-final hasher and key_equal
- using map_type = unord_map_type<std::unordered_multimap, transparent_hash,
- std::equal_to<> >;
- test_transparent_equal_range<map_type>(ilist_type{{1, 2}, {1, 3}, {2, 3}});
+ using M = unord_map_type<std::unordered_multimap, transparent_hash, std::equal_to<>>;
+ test_transparent_equal_range<M>({{1, 2}, {1, 3}, {2, 3}});
+ test_transparent_equal_range<const M>({{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<std::unordered_multimap, transparent_hash_final,
- transparent_equal_final>;
- test_transparent_equal_range<map_type>(ilist_type{{1, 2}, {1, 3}, {2, 3}});
+ using M = unord_map_type<std::unordered_multimap, transparent_hash_final, transparent_equal_final>;
+ test_transparent_equal_range<M>({{1, 2}, {1, 3}, {2, 3}});
+ test_transparent_equal_range<const M>({{1, 2}, {1, 3}, {2, 3}});
}
{
// Make sure conversions do happen for non-transparent hasher
- using map_type = unord_map_type<std::unordered_multimap, non_transparent_hash,
- std::equal_to<> >;
- test_non_transparent_equal_range<map_type>(ilist_type{{1, 2}, {1, 3}, {2, 3}});
+ using M = unord_map_type<std::unordered_multimap, non_transparent_hash, std::equal_to<>>;
+ test_non_transparent_equal_range<M>({{1, 2}, {1, 3}, {2, 3}});
+ test_non_transparent_equal_range<const M>({{1, 2}, {1, 3}, {2, 3}});
}
{
// Make sure conversions do happen for non-transparent key_equal
- using map_type = unord_map_type<std::unordered_multimap, transparent_hash,
- std::equal_to<key_type> >;
- test_non_transparent_equal_range<map_type>(ilist_type{{1, 2}, {1, 3}, {2, 3}});
+ using M = unord_map_type<std::unordered_multimap, transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_equal_range<M>({{1, 2}, {1, 3}, {2, 3}});
+ test_non_transparent_equal_range<const M>({{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<std::unordered_multimap, non_transparent_hash,
- std::equal_to<key_type> >;
- test_non_transparent_equal_range<map_type>(ilist_type{{1, 2}, {1, 3}, {2, 3}});
+ using M = unord_map_type<std::unordered_multimap, non_transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_equal_range<M>({{1, 2}, {1, 3}, {2, 3}});
+ test_non_transparent_equal_range<const M>({{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
deleted file mode 100644
index 2444e9ca9dc41..0000000000000
--- a/libcxx/test/std/containers/unord/unord.multimap/equal_range_const.transparent.pass.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-
-// <unordered_map>
-
-// template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>,
-// class Alloc = allocator<pair<const Key, T>>>
-// class unordered_multimap
-
-// template <typename K>
-// pair<const_iterator, const_iterator> equal_range(const K& k) const;
-
-// UNSUPPORTED: c++03, c++11, c++14, c++17
-
-#include <unordered_map>
-
-#include "test_transparent_unordered.h"
-
-int main(int, char**)
-{
- using key_type = StoredType<int>;
- using ilist_type = std::initializer_list<std::pair<const key_type, int> >;
-
- {
- // Make sure conversions don't happen for transparent non-final hasher and key_equal
- using map_type = const unord_map_type<std::unordered_multimap, transparent_hash,
- std::equal_to<> >;
- test_transparent_equal_range<map_type>(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<std::unordered_multimap, transparent_hash_final,
- transparent_equal_final>;
- test_transparent_equal_range<map_type>(ilist_type{{1, 2}, {1, 3}, {2, 3}});
- }
-
- {
- // Make sure conversions do happen for non-transparent hasher
- using map_type = const unord_map_type<std::unordered_multimap, non_transparent_hash,
- std::equal_to<> >;
- test_non_transparent_equal_range<map_type>(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<std::unordered_multimap, transparent_hash,
- std::equal_to<key_type> >;
- test_non_transparent_equal_range<map_type>(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<std::unordered_multimap, non_transparent_hash,
- std::equal_to<key_type> >;
- test_non_transparent_equal_range<map_type>(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.transparent.pass.cpp
similarity index 52%
rename from libcxx/test/std/containers/unord/unord.multimap/find_non_const.transparent.pass.cpp
rename to libcxx/test/std/containers/unord/unord.multimap/find.transparent.pass.cpp
index 676c82a3bab19..4a32248b13ad6 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/find_non_const.transparent.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/find.transparent.pass.cpp
@@ -24,41 +24,40 @@
int main(int, char**)
{
using key_type = StoredType<int>;
- using ilist_type = std::initializer_list<std::pair<const key_type, int> >;
{
// Make sure conversions don't happen for transparent non-final hasher and key_equal
- using map_type = unord_map_type<std::unordered_multimap, transparent_hash,
- std::equal_to<> >;
- test_transparent_find<map_type>(ilist_type{{1, 2}, {1, 3}, {2, 3}});
+ using M = unord_map_type<std::unordered_multimap, transparent_hash, std::equal_to<>>;
+ test_transparent_find<M>({{1, 2}, {1, 3}, {2, 3}});
+ test_transparent_find<const M>({{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<std::unordered_multimap, transparent_hash_final,
- transparent_equal_final>;
- test_transparent_find<map_type>(ilist_type{{1, 2}, {1, 3}, {2, 3}});
+ using M = unord_map_type<std::unordered_multimap, transparent_hash_final, transparent_equal_final>;
+ test_transparent_find<M>({{1, 2}, {1, 3}, {2, 3}});
+ test_transparent_find<const M>({{1, 2}, {1, 3}, {2, 3}});
}
{
// Make sure conversions do happen for non-transparent hasher
- using map_type = unord_map_type<std::unordered_multimap, non_transparent_hash,
- std::equal_to<> >;
- test_non_transparent_find<map_type>(ilist_type{{1, 2}, {1, 3}, {2, 3}});
+ using M = unord_map_type<std::unordered_multimap, non_transparent_hash, std::equal_to<>>;
+ test_non_transparent_find<M>({{1, 2}, {1, 3}, {2, 3}});
+ test_non_transparent_find<const M>({{1, 2}, {1, 3}, {2, 3}});
}
{
// Make sure conversions do happen for non-transparent key_equal
- using map_type = unord_map_type<std::unordered_multimap, transparent_hash,
- std::equal_to<key_type> >;
- test_non_transparent_find<map_type>(ilist_type{{1, 2}, {1, 3}, {2, 3}});
+ using M = unord_map_type<std::unordered_multimap, transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_find<M>({{1, 2}, {1, 3}, {2, 3}});
+ test_non_transparent_find<const M>({{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<std::unordered_multimap, non_transparent_hash,
- std::equal_to<key_type> >;
- test_non_transparent_find<map_type>(ilist_type{{1, 2}, {1, 3}, {2, 3}});
+ using M = unord_map_type<std::unordered_multimap, non_transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_find<M>({{1, 2}, {1, 3}, {2, 3}});
+ test_non_transparent_find<const M>({{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
deleted file mode 100644
index 3737866cf4e07..0000000000000
--- a/libcxx/test/std/containers/unord/unord.multimap/find_const.transparent.pass.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-
-// <unordered_map>
-
-// template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>,
-// class Alloc = allocator<pair<const Key, T>>>
-// class unordered_multimap
-
-// template <typename K>
-// const_iterator find(const K& k) const;
-
-// UNSUPPORTED: c++03, c++11, c++14, c++17
-
-#include <unordered_map>
-
-#include "test_transparent_unordered.h"
-
-int main(int, char**)
-{
- using key_type = StoredType<int>;
- using ilist_type = std::initializer_list<std::pair<const key_type, int> >;
-
- {
- // Make sure conversions don't happen for transparent non-final hasher and key_equal
- using map_type = const unord_map_type<std::unordered_multimap, transparent_hash,
- std::equal_to<> >;
- test_transparent_find<map_type>(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<std::unordered_multimap, transparent_hash_final,
- transparent_equal_final>;
- test_transparent_find<map_type>(ilist_type{{1, 2}, {1, 3}, {2, 3}});
- }
-
- {
- // Make sure conversions do happen for non-transparent hasher
- using map_type = const unord_map_type<std::unordered_multimap, non_transparent_hash,
- std::equal_to<> >;
- test_non_transparent_find<map_type>(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<std::unordered_multimap, transparent_hash,
- std::equal_to<key_type> >;
- test_non_transparent_find<map_type>(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<std::unordered_multimap, non_transparent_hash,
- std::equal_to<key_type> >;
- test_non_transparent_find<map_type>(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
index 0256d71c46904..b14021c6b8c8c 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/contains.transparent.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/contains.transparent.pass.cpp
@@ -26,38 +26,37 @@ int main(int, char**)
{
// Make sure conversions don't happen for transparent non-final hasher and key_equal
- using set_type = unord_set_type<std::unordered_multiset, transparent_hash,
- std::equal_to<> >;
- test_transparent_contains<set_type>(key_type{1}, key_type{1}, key_type{2});
+ using S = unord_set_type<std::unordered_multiset, transparent_hash, std::equal_to<>>;
+ test_transparent_contains<S>({1, 1, 2});
+ test_transparent_contains<const S>({1, 1, 2});
}
{
// Make sure conversions don't happen for transparent final hasher and key_equal
- using set_type = unord_set_type<std::unordered_multiset, transparent_hash_final, transparent_equal_final>;
- test_transparent_contains<set_type>(key_type{1}, key_type{1}, key_type{2});
+ using S = unord_set_type<std::unordered_multiset, transparent_hash_final, transparent_equal_final>;
+ test_transparent_contains<S>({1, 1, 2});
+ test_transparent_contains<const S>({1, 1, 2});
}
{
// Make sure conversions do happen for non-transparent hasher
- using set_type = unord_set_type<std::unordered_multiset, non_transparent_hash,
- std::equal_to<> >;
- test_non_transparent_contains<set_type>(key_type{1}, key_type{1}, key_type{2});
+ using S = unord_set_type<std::unordered_multiset, non_transparent_hash, std::equal_to<>>;
+ test_non_transparent_contains<S>({1, 1, 2});
+ test_non_transparent_contains<const S>({1, 1, 2});
}
{
// Make sure conversions do happen for non-transparent key_equal
- using set_type = unord_set_type<std::unordered_multiset, transparent_hash,
- std::equal_to<key_type> >;
- test_non_transparent_contains<set_type>(
- key_type{1}, key_type{1}, key_type{2});
+ using S = unord_set_type<std::unordered_multiset, transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_contains<S>({1, 1, 2});
+ test_non_transparent_contains<const S>({1, 1, 2});
}
{
// Make sure conversions do happen for both non-transparent hasher and key_equal
- using set_type = unord_set_type<std::unordered_multiset, non_transparent_hash,
- std::equal_to<key_type> >;
- test_non_transparent_contains<set_type>(
- key_type{1}, key_type{1}, key_type{2});
+ using S = unord_set_type<std::unordered_multiset, non_transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_contains<S>({1, 1, 2});
+ test_non_transparent_contains<const S>({1, 1, 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
index a56a12a902c10..64f9eddbddae0 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/count.transparent.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/count.transparent.pass.cpp
@@ -27,35 +27,37 @@ int main(int, char**)
{
// Make sure conversions don't happen for transparent non-final hasher and key_equal
- using set_type = const unord_set_type<std::unordered_multiset, transparent_hash, std::equal_to<> >;
- test_transparent_count<set_type>(key_type{1}, key_type{1}, key_type{2});
+ using S = unord_set_type<std::unordered_multiset, transparent_hash, std::equal_to<>>;
+ test_transparent_count<S>({1, 1, 2});
+ test_transparent_count<const S>({1, 1, 2});
}
{
// Make sure conversions don't happen for transparent final hasher and key_equal
- using set_type =
- const unord_set_type<std::unordered_multiset, transparent_hash_final, transparent_equal_final>;
- test_transparent_count<set_type>(key_type{1}, key_type{1}, key_type{2});
+ using S = unord_set_type<std::unordered_multiset, transparent_hash_final, transparent_equal_final>;
+ test_transparent_count<S>({1, 1, 2});
+ test_transparent_count<const S>({1, 1, 2});
}
{
// Make sure conversions do happen for non-transparent hasher
- using set_type = const unord_set_type<std::unordered_multiset, non_transparent_hash, std::equal_to<> >;
- test_non_transparent_count<set_type>(key_type{1}, key_type{1}, key_type{2});
+ using S = unord_set_type<std::unordered_multiset, non_transparent_hash, std::equal_to<>>;
+ test_non_transparent_count<S>({1, 1, 2});
+ test_non_transparent_count<const S>({1, 1, 2});
}
{
// Make sure conversions do happen for non-transparent key_equal
- using set_type =
- const unord_set_type<std::unordered_multiset, transparent_hash, std::equal_to<key_type> >;
- test_non_transparent_count<set_type>(key_type{1}, key_type{1}, key_type{2});
+ using S = unord_set_type<std::unordered_multiset, transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_count<S>({1, 1, 2});
+ test_non_transparent_count<const S>({1, 1, 2});
}
{
// Make sure conversions do happen for both non-transparent hasher and key_equal
- using set_type =
- const unord_set_type<std::unordered_multiset, non_transparent_hash, std::equal_to<key_type> >;
- test_non_transparent_count<set_type>(key_type{1}, key_type{1}, key_type{2});
+ using S = unord_set_type<std::unordered_multiset, non_transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_count<S>({1, 1, 2});
+ test_non_transparent_count<const S>({1, 1, 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.multiset/equal_range.transparent.pass.cpp
similarity index 53%
rename from libcxx/test/std/containers/unord/unord.set/equal_range_const.transparent.pass.cpp
rename to libcxx/test/std/containers/unord/unord.multiset/equal_range.transparent.pass.cpp
index 0c3f18bb43822..741058d8d2514 100644
--- a/libcxx/test/std/containers/unord/unord.set/equal_range_const.transparent.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/equal_range.transparent.pass.cpp
@@ -10,7 +10,7 @@
// template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>,
// class Alloc = allocator<pair<const Key, T>>>
-// class unordered_set
+// class unordered_multiset
// template <typename K>
// pair<const_iterator, const_iterator> equal_range(const K& k) const;
@@ -27,37 +27,37 @@ int main(int, char**)
{
// Make sure conversions don't happen for transparent non-final hasher and key_equal
- using set_type = const unord_set_type<std::unordered_set, transparent_hash,
- std::equal_to<> >;
- test_transparent_equal_range<set_type>(key_type{1}, key_type{2});
+ using S = unord_set_type<std::unordered_multiset, transparent_hash, std::equal_to<>>;
+ test_transparent_equal_range<S>({1, 1, 2});
+ test_transparent_equal_range<const S>({1, 1, 2});
}
{
// Make sure conversions don't happen for transparent final hasher and key_equal
- using set_type = const unord_set_type<std::unordered_set, transparent_hash_final,
- transparent_equal_final>;
- test_transparent_equal_range<set_type>(key_type{1}, key_type{2});
+ using S = unord_set_type<std::unordered_multiset, transparent_hash_final, transparent_equal_final>;
+ test_transparent_equal_range<S>({1, 1, 2});
+ test_transparent_equal_range<const S>({1, 1, 2});
}
{
// Make sure conversions do happen for non-transparent hasher
- using set_type = const unord_set_type<std::unordered_set, non_transparent_hash,
- std::equal_to<> >;
- test_non_transparent_equal_range<set_type>(key_type{1}, key_type{2});
+ using S = unord_set_type<std::unordered_multiset, non_transparent_hash, std::equal_to<>>;
+ test_non_transparent_equal_range<S>({1, 1, 2});
+ test_non_transparent_equal_range<const S>({1, 1, 2});
}
{
// Make sure conversions do happen for non-transparent key_equal
- using set_type = const unord_set_type<std::unordered_set, transparent_hash,
- std::equal_to<key_type> >;
- test_non_transparent_equal_range<set_type>(key_type{1}, key_type{2});
+ using S = unord_set_type<std::unordered_multiset, transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_equal_range<S>({1, 1, 2});
+ test_non_transparent_equal_range<const S>({1, 1, 2});
}
{
// Make sure conversions do happen for both non-transparent hasher and key_equal
- using set_type = const unord_set_type<std::unordered_set, non_transparent_hash,
- std::equal_to<key_type> >;
- test_non_transparent_equal_range<set_type>(key_type{1}, key_type{2});
+ using S = unord_set_type<std::unordered_multiset, non_transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_equal_range<S>({1, 1, 2});
+ test_non_transparent_equal_range<const S>({1, 1, 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
deleted file mode 100644
index 991ffcd30deea..0000000000000
--- a/libcxx/test/std/containers/unord/unord.multiset/equal_range_const.transparent.pass.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-
-// <unordered_set>
-
-// template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>,
-// class Alloc = allocator<pair<const Key, T>>>
-// class unordered_multiset
-
-// template <typename K>
-// pair<const_iterator, const_iterator> equal_range(const K& k) const;
-
-// UNSUPPORTED: c++03, c++11, c++14, c++17
-
-#include <unordered_set>
-
-#include "test_transparent_unordered.h"
-
-int main(int, char**)
-{
- using key_type = StoredType<int>;
-
- {
- // Make sure conversions don't happen for transparent non-final hasher and key_equal
- using set_type = const unord_set_type<std::unordered_multiset, transparent_hash,
- std::equal_to<> >;
- test_transparent_equal_range<set_type>(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<std::unordered_multiset, transparent_hash_final,
- transparent_equal_final>;
- test_transparent_equal_range<set_type>(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<std::unordered_multiset, non_transparent_hash,
- std::equal_to<> >;
- test_non_transparent_equal_range<set_type>(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<std::unordered_multiset, transparent_hash,
- std::equal_to<key_type> >;
- test_non_transparent_equal_range<set_type>(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<std::unordered_multiset, non_transparent_hash,
- std::equal_to<key_type> >;
- test_non_transparent_equal_range<set_type>(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
deleted file mode 100644
index dc84dc6a50c88..0000000000000
--- a/libcxx/test/std/containers/unord/unord.multiset/equal_range_non_const.transparent.pass.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-
-// <unordered_set>
-
-// template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>,
-// class Alloc = allocator<pair<const Key, T>>>
-// class unordered_multiset
-
-// template <typename K>
-// pair<iterator, iterator> equal_range(const K& k);
-
-// UNSUPPORTED: c++03, c++11, c++14, c++17
-
-#include <unordered_set>
-
-#include "test_transparent_unordered.h"
-
-int main(int, char**)
-{
- using key_type = StoredType<int>;
-
- {
- // Make sure conversions don't happen for transparent non-final hasher and key_equal
- using set_type = unord_set_type<std::unordered_multiset, transparent_hash,
- std::equal_to<> >;
- test_transparent_equal_range<set_type>(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<std::unordered_multiset, transparent_hash_final,
- transparent_equal_final>;
- test_transparent_equal_range<set_type>(key_type{1}, key_type{1}, key_type{2});
- }
-
- {
- // Make sure conversions do happen for non-transparent hasher
- using set_type = unord_set_type<std::unordered_multiset, non_transparent_hash,
- std::equal_to<> >;
- test_non_transparent_equal_range<set_type>(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<std::unordered_multiset, transparent_hash,
- std::equal_to<key_type> >;
- test_non_transparent_equal_range<set_type>(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<std::unordered_multiset, non_transparent_hash,
- std::equal_to<key_type> >;
- test_non_transparent_equal_range<set_type>(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.transparent.pass.cpp
similarity index 53%
rename from libcxx/test/std/containers/unord/unord.multiset/find_non_const.transparent.pass.cpp
rename to libcxx/test/std/containers/unord/unord.multiset/find.transparent.pass.cpp
index 3255c8c6ab4f3..27abb1569e419 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/find_non_const.transparent.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/find.transparent.pass.cpp
@@ -27,37 +27,37 @@ int main(int, char**)
{
// Make sure conversions don't happen for transparent non-final hasher and key_equal
- using set_type = unord_set_type<std::unordered_multiset, transparent_hash,
- std::equal_to<> >;
- test_transparent_find<set_type>(key_type{1}, key_type{1}, key_type{2});
+ using S = unord_set_type<std::unordered_multiset, transparent_hash, std::equal_to<>>;
+ test_transparent_find<S>({1, 1, 2});
+ test_transparent_find<const S>({1, 1, 2});
}
{
// Make sure conversions don't happen for transparent final hasher and key_equal
- using set_type = unord_set_type<std::unordered_multiset, transparent_hash_final,
- transparent_equal_final>;
- test_transparent_find<set_type>(key_type{1}, key_type{1}, key_type{2});
+ using S = unord_set_type<std::unordered_multiset, transparent_hash_final, transparent_equal_final>;
+ test_transparent_find<S>({1, 1, 2});
+ test_transparent_find<const S>({1, 1, 2});
}
{
// Make sure conversions do happen for non-transparent hasher
- using set_type = unord_set_type<std::unordered_multiset, non_transparent_hash,
- std::equal_to<> >;
- test_non_transparent_find<set_type>(key_type{1}, key_type{1}, key_type{2});
+ using S = unord_set_type<std::unordered_multiset, non_transparent_hash, std::equal_to<>>;
+ test_non_transparent_find<S>({1, 1, 2});
+ test_non_transparent_find<const S>({1, 1, 2});
}
{
// Make sure conversions do happen for non-transparent key_equal
- using set_type = unord_set_type<std::unordered_multiset, transparent_hash,
- std::equal_to<key_type> >;
- test_non_transparent_find<set_type>(key_type{1}, key_type{1}, key_type{2});
+ using S = unord_set_type<std::unordered_multiset, transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_find<S>({1, 1, 2});
+ test_non_transparent_find<const S>({1, 1, 2});
}
{
// Make sure conversions do happen for both non-transparent hasher and key_equal
- using set_type = unord_set_type<std::unordered_multiset, non_transparent_hash,
- std::equal_to<key_type> >;
- test_non_transparent_find<set_type>(key_type{1}, key_type{1}, key_type{2});
+ using S = unord_set_type<std::unordered_multiset, non_transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_find<S>({1, 1, 2});
+ test_non_transparent_find<const S>({1, 1, 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
deleted file mode 100644
index c3a7654625144..0000000000000
--- a/libcxx/test/std/containers/unord/unord.multiset/find_const.transparent.pass.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-
-// <unordered_set>
-
-// template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>,
-// class Alloc = allocator<pair<const Key, T>>>
-// class unordered_multiset
-
-// template <typename K>
-// const_iterator find(const K& k) const;
-
-// UNSUPPORTED: c++03, c++11, c++14, c++17
-
-#include <unordered_set>
-
-#include "test_transparent_unordered.h"
-
-int main(int, char**)
-{
- using key_type = StoredType<int>;
-
- {
- // Make sure conversions don't happen for transparent non-final hasher and key_equal
- using set_type = const unord_set_type<std::unordered_multiset, transparent_hash,
- std::equal_to<> >;
- test_transparent_find<set_type>(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<std::unordered_multiset, transparent_hash_final,
- transparent_equal_final>;
- test_transparent_find<set_type>(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<std::unordered_multiset, non_transparent_hash,
- std::equal_to<> >;
- test_non_transparent_find<set_type>(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<std::unordered_multiset, transparent_hash,
- std::equal_to<key_type> >;
- test_non_transparent_find<set_type>(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<std::unordered_multiset, non_transparent_hash,
- std::equal_to<key_type> >;
- test_non_transparent_find<set_type>(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
index 6adf6ab4313e6..78908053aa2f5 100644
--- a/libcxx/test/std/containers/unord/unord.set/contains.transparent.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/contains.transparent.pass.cpp
@@ -10,7 +10,7 @@
// template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
// class Alloc = allocator<Value>>
-// class unordered_multiset
+// class unordered_set
// template <typename K>
// bool contains(const K& x) const;
@@ -26,35 +26,37 @@ int main(int, char**)
{
// Make sure conversions don't happen for transparent non-final hasher and key_equal
- using set_type = const unord_set_type<std::unordered_set, transparent_hash, std::equal_to<> >;
- test_transparent_contains<set_type>(key_type(1), key_type(2));
+ using S = unord_set_type<std::unordered_set, transparent_hash, std::equal_to<>>;
+ test_transparent_contains<S>({1, 2});
+ test_transparent_contains<const S>({1, 2});
}
{
// Make sure conversions don't happen for transparent final hasher and key_equal
- using set_type = const unord_set_type<std::unordered_set, transparent_hash_final, transparent_equal_final>;
- test_transparent_contains<set_type>(key_type(1), key_type(2));
+ using S = unord_set_type<std::unordered_set, transparent_hash_final, transparent_equal_final>;
+ test_transparent_contains<S>({1, 2});
+ test_transparent_contains<const S>({1, 2});
}
{
// Make sure conversions do happen for non-transparent hasher
- using set_type = const unord_set_type<std::unordered_set, non_transparent_hash,
- std::equal_to<> >;
- test_non_transparent_contains<set_type>(key_type(1), key_type(2));
+ using S = unord_set_type<std::unordered_set, non_transparent_hash, std::equal_to<>>;
+ test_non_transparent_contains<S>({1, 2});
+ test_non_transparent_contains<const S>({1, 2});
}
{
// Make sure conversions do happen for non-transparent key_equal
- using set_type = const unord_set_type<std::unordered_set, transparent_hash,
- std::equal_to<key_type> >;
- test_non_transparent_contains<set_type>(key_type(1), key_type(2));
+ using S = unord_set_type<std::unordered_set, transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_contains<S>({1, 2});
+ test_non_transparent_contains<const S>({1, 2});
}
{
// Make sure conversions do happen for both non-transparent hasher and key_equal
- using set_type = const unord_set_type<std::unordered_set, non_transparent_hash,
- std::equal_to<key_type> >;
- test_non_transparent_contains<set_type>(key_type(1), key_type(2));
+ using S = unord_set_type<std::unordered_set, non_transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_contains<S>({1, 2});
+ test_non_transparent_contains<const S>({1, 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
index 277308ea53239..32af0a54cc5b5 100644
--- a/libcxx/test/std/containers/unord/unord.set/count.transparent.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/count.transparent.pass.cpp
@@ -27,35 +27,37 @@ int main(int, char**)
{
// Make sure conversions don't happen for transparent non-final hasher and key_equal
- using set_type = const unord_set_type<std::unordered_set, transparent_hash, std::equal_to<> >;
- test_transparent_count<set_type>(key_type{1}, key_type{2});
+ using S = unord_set_type<std::unordered_set, transparent_hash, std::equal_to<>>;
+ test_transparent_count<S>({1, 2});
+ test_transparent_count<const S>({1, 2});
}
{
// Make sure conversions don't happen for transparent final hasher and key_equal
- using set_type =
- const unord_set_type<std::unordered_set, transparent_hash_final, transparent_equal_final>;
- test_transparent_count<set_type>(key_type{1}, key_type{2});
+ using S = unord_set_type<std::unordered_set, transparent_hash_final, transparent_equal_final>;
+ test_transparent_count<S>({1, 2});
+ test_transparent_count<const S>({1, 2});
}
{
// Make sure conversions do happen for non-transparent hasher
- using set_type = const unord_set_type<std::unordered_set, non_transparent_hash, std::equal_to<> >;
- test_non_transparent_count<set_type>(key_type{1}, key_type{2});
+ using S = unord_set_type<std::unordered_set, non_transparent_hash, std::equal_to<>>;
+ test_non_transparent_count<S>({1, 2});
+ test_non_transparent_count<const S>({1, 2});
}
{
// Make sure conversions do happen for non-transparent key_equal
- using set_type =
- const unord_set_type<std::unordered_set, transparent_hash, std::equal_to<key_type> >;
- test_non_transparent_count<set_type>(key_type{1}, key_type{2});
+ using S = unord_set_type<std::unordered_set, transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_count<S>({1, 2});
+ test_non_transparent_count<const S>({1, 2});
}
{
// Make sure conversions do happen for both non-transparent hasher and key_equal
- using set_type =
- const unord_set_type<std::unordered_set, non_transparent_hash, std::equal_to<key_type> >;
- test_non_transparent_count<set_type>(key_type{1}, key_type{2});
+ using S = unord_set_type<std::unordered_set, non_transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_count<S>({1, 2});
+ test_non_transparent_count<const S>({1, 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.transparent.pass.cpp
similarity index 55%
rename from libcxx/test/std/containers/unord/unord.set/equal_range_non_const.transparent.pass.cpp
rename to libcxx/test/std/containers/unord/unord.set/equal_range.transparent.pass.cpp
index 452d15d7b0c9f..9844d83cda465 100644
--- 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.transparent.pass.cpp
@@ -27,37 +27,37 @@ int main(int, char**)
{
// Make sure conversions don't happen for transparent non-final hasher and key_equal
- using set_type = unord_set_type<std::unordered_set, transparent_hash,
- std::equal_to<> >;
- test_transparent_equal_range<set_type>(key_type{1}, key_type{2});
+ using S = unord_set_type<std::unordered_set, transparent_hash, std::equal_to<>>;
+ test_transparent_equal_range<S>({1, 2});
+ test_transparent_equal_range<const S>({1, 2});
}
{
// Make sure conversions don't happen for transparent final hasher and key_equal
- using set_type = unord_set_type<std::unordered_set, transparent_hash_final,
- transparent_equal_final>;
- test_transparent_equal_range<set_type>(key_type{1}, key_type{2});
+ using S = unord_set_type<std::unordered_set, transparent_hash_final, transparent_equal_final>;
+ test_transparent_equal_range<S>({1, 2});
+ test_transparent_equal_range<const S>({1, 2});
}
{
// Make sure conversions do happen for non-transparent hasher
- using set_type = unord_set_type<std::unordered_set, non_transparent_hash,
- std::equal_to<> >;
- test_non_transparent_equal_range<set_type>(key_type{1}, key_type{2});
+ using S = unord_set_type<std::unordered_set, non_transparent_hash, std::equal_to<>>;
+ test_non_transparent_equal_range<S>({1, 2});
+ test_non_transparent_equal_range<const S>({1, 2});
}
{
// Make sure conversions do happen for non-transparent key_equal
- using set_type = unord_set_type<std::unordered_set, transparent_hash,
- std::equal_to<key_type> >;
- test_non_transparent_equal_range<set_type>(key_type{1}, key_type{2});
+ using S = unord_set_type<std::unordered_set, transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_equal_range<S>({1, 2});
+ test_non_transparent_equal_range<const S>({1, 2});
}
{
// Make sure conversions do happen for both non-transparent hasher and key_equal
- using set_type = unord_set_type<std::unordered_set, non_transparent_hash,
- std::equal_to<key_type> >;
- test_non_transparent_equal_range<set_type>(key_type{1}, key_type{2});
+ using S = unord_set_type<std::unordered_set, non_transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_equal_range<S>({1, 2});
+ test_non_transparent_equal_range<const S>({1, 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.transparent.pass.cpp
similarity index 55%
rename from libcxx/test/std/containers/unord/unord.set/find_non_const.transparent.pass.cpp
rename to libcxx/test/std/containers/unord/unord.set/find.transparent.pass.cpp
index 7fa3508ae09e2..7510dd3514e65 100644
--- a/libcxx/test/std/containers/unord/unord.set/find_non_const.transparent.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/find.transparent.pass.cpp
@@ -27,37 +27,37 @@ int main(int, char**)
{
// Make sure conversions don't happen for transparent non-final hasher and key_equal
- using set_type = unord_set_type<std::unordered_set, transparent_hash,
- std::equal_to<> >;
- test_transparent_find<set_type>(key_type{1}, key_type{2});
+ using S = unord_set_type<std::unordered_set, transparent_hash, std::equal_to<>>;
+ test_transparent_find<S>({1, 2});
+ test_transparent_find<const S>({1, 2});
}
{
// Make sure conversions don't happen for transparent final hasher and key_equal
- using set_type = unord_set_type<std::unordered_set, transparent_hash_final,
- transparent_equal_final>;
- test_transparent_find<set_type>(key_type{1}, key_type{2});
+ using S = unord_set_type<std::unordered_set, transparent_hash_final, transparent_equal_final>;
+ test_transparent_find<S>({1, 2});
+ test_transparent_find<const S>({1, 2});
}
{
// Make sure conversions do happen for non-transparent hasher
- using set_type = unord_set_type<std::unordered_set, non_transparent_hash,
- std::equal_to<> >;
- test_non_transparent_find<set_type>(key_type{1}, key_type{2});
+ using S = unord_set_type<std::unordered_set, non_transparent_hash, std::equal_to<>>;
+ test_non_transparent_find<S>({1, 2});
+ test_non_transparent_find<const S>({1, 2});
}
{
// Make sure conversions do happen for non-transparent key_equal
- using set_type = unord_set_type<std::unordered_set, transparent_hash,
- std::equal_to<key_type> >;
- test_non_transparent_find<set_type>(key_type{1}, key_type{2});
+ using S = unord_set_type<std::unordered_set, transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_find<S>({1, 2});
+ test_non_transparent_find<const S>({1, 2});
}
{
// Make sure conversions do happen for both non-transparent hasher and key_equal
- using set_type = unord_set_type<std::unordered_set, non_transparent_hash,
- std::equal_to<key_type> >;
- test_non_transparent_find<set_type>(key_type{1}, key_type{2});
+ using S = unord_set_type<std::unordered_set, non_transparent_hash, std::equal_to<key_type>>;
+ test_non_transparent_find<S>({1, 2});
+ test_non_transparent_find<const S>({1, 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
deleted file mode 100644
index 6256ef35f5a8c..0000000000000
--- a/libcxx/test/std/containers/unord/unord.set/find_const.transparent.pass.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-
-// <unordered_set>
-
-// template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>,
-// class Alloc = allocator<pair<const Key, T>>>
-// class unordered_set
-
-// template <typename K>
-// const_iterator find(const K& k) const;
-
-// UNSUPPORTED: c++03, c++11, c++14, c++17
-
-#include <unordered_set>
-
-#include "test_transparent_unordered.h"
-
-int main(int, char**)
-{
- using key_type = StoredType<int>;
-
- {
- // Make sure conversions don't happen for transparent non-final hasher and key_equal
- using set_type = const unord_set_type<std::unordered_set, transparent_hash,
- std::equal_to<> >;
- test_transparent_find<set_type>(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<std::unordered_set, transparent_hash_final,
- transparent_equal_final>;
- test_transparent_find<set_type>(key_type{1}, key_type{2});
- }
-
- {
- // Make sure conversions do happen for non-transparent hasher
- using set_type = const unord_set_type<std::unordered_set, non_transparent_hash,
- std::equal_to<> >;
- test_non_transparent_find<set_type>(key_type{1}, key_type{2});
- }
-
- {
- // Make sure conversions do happen for non-transparent key_equal
- using set_type = const unord_set_type<std::unordered_set, transparent_hash,
- std::equal_to<key_type> >;
- test_non_transparent_find<set_type>(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<std::unordered_set, non_transparent_hash,
- std::equal_to<key_type> >;
- test_non_transparent_find<set_type>(key_type{1}, key_type{2});
- }
-
- return 0;
-}
diff --git a/libcxx/test/support/is_transparent.h b/libcxx/test/support/is_transparent.h
index 9cc69f04fc657..700c894a8b60f 100644
--- a/libcxx/test/support/is_transparent.h
+++ b/libcxx/test/support/is_transparent.h
@@ -83,85 +83,4 @@ bool operator <(const C2Int& rhs, int lhs) { return rhs.get() < lhs;
#endif // TEST_STD_VER > 11
-#if TEST_STD_VER > 17
-
-template <typename T>
-struct StoredType;
-
-template <typename T>
-struct SearchedType;
-
-struct hash_impl {
- template <typename T>
- constexpr std::size_t operator()(SearchedType<T> const& t) const {
- return static_cast<std::size_t>(t.get_value());
- }
-
- template <typename T>
- constexpr std::size_t operator()(StoredType<T> const& t) const {
- return static_cast<std::size_t>(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 <typename T>
-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<T>() const {
- ++*conversions_;
- return StoredType<T>{value_};
- }
-
- int get_value() const {
- return value_;
- }
-
-private:
- T value_;
- int* conversions_;
-};
-
-template <typename T>
-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<T> 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<T>
- // in a container full of StoredType<T>.
- friend bool operator==(StoredType const& lhs, SearchedType<T> const& rhs) {
- return lhs.value_ == rhs.get_value();
- }
- friend bool operator==(SearchedType<T> const& lhs, StoredType<T> 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
index 7bcbc19c05a86..e2d02402d808b 100644
--- a/libcxx/test/support/test_transparent_unordered.h
+++ b/libcxx/test/support/test_transparent_unordered.h
@@ -14,121 +14,172 @@
#include <cassert>
-// testing transparent unordered containers
#if TEST_STD_VER > 17
-template <template <typename...> class UnorderedSet, typename Hash,
- typename Equal>
+template <typename T>
+struct StoredType;
+
+template <typename T>
+struct SearchedType;
+
+struct hash_impl {
+ template <typename T>
+ constexpr std::size_t operator()(SearchedType<T> const& t) const {
+ return static_cast<std::size_t>(t.get_value());
+ }
+
+ template <typename T>
+ constexpr std::size_t operator()(StoredType<T> const& t) const {
+ return static_cast<std::size_t>(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 <typename T>
+struct SearchedType {
+ explicit SearchedType(T value, int *counter) : value_(value), conversions_(counter) { }
+
+ // Whenever a conversion is performed, increment the counter to keep track
+ // of conversions.
+ operator StoredType<T>() const {
+ ++*conversions_;
+ return StoredType<T>{value_};
+ }
+
+ int get_value() const {
+ return value_;
+ }
+
+private:
+ T value_;
+ int *conversions_;
+};
+
+template <typename T>
+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<T> 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<T>
+ // in a container full of StoredType<T>.
+ friend bool operator==(StoredType const& lhs, SearchedType<T> const& rhs) {
+ return lhs.value_ == rhs.get_value();
+ }
+
+ int get_value() const {
+ return value_;
+ }
+
+private:
+ T value_;
+};
+
+template<template<class...> class UnorderedSet, class Hash, class Equal>
using unord_set_type = UnorderedSet<StoredType<int>, Hash, Equal>;
-template <template <typename...> class UnorderedMap, typename Hash,
- typename Equal>
+template<template<class...> class UnorderedMap, class Hash, class Equal>
using unord_map_type = UnorderedMap<StoredType<int>, int, Hash, Equal>;
-template <typename Container, typename... Args>
-void test_transparent_find(Args&&... args) {
- Container c{std::forward<Args>(args)...};
+template<class Container>
+void test_transparent_find(Container c) {
int conversions = 0;
assert(c.find(SearchedType<int>(1, &conversions)) != c.end());
assert(c.find(SearchedType<int>(2, &conversions)) != c.end());
- assert(conversions == 0);
assert(c.find(SearchedType<int>(3, &conversions)) == c.end());
assert(conversions == 0);
}
-template <typename Container, typename... Args>
-void test_non_transparent_find(Args&&... args) {
- Container c{std::forward<Args>(args)...};
+template<class Container>
+void test_non_transparent_find(Container c) {
int conversions = 0;
assert(c.find(SearchedType<int>(1, &conversions)) != c.end());
- assert(conversions > 0);
- conversions = 0;
+ assert(conversions == 1);
assert(c.find(SearchedType<int>(2, &conversions)) != c.end());
- assert(conversions > 0);
- conversions = 0;
+ assert(conversions == 2);
assert(c.find(SearchedType<int>(3, &conversions)) == c.end());
- assert(conversions > 0);
+ assert(conversions == 3);
}
-template <typename Container, typename... Args>
-void test_transparent_count(Args&&... args) {
- Container c{std::forward<Args>(args)...};
+template<class Container>
+void test_transparent_count(Container c) {
int conversions = 0;
assert(c.count(SearchedType<int>(1, &conversions)) > 0);
assert(c.count(SearchedType<int>(2, &conversions)) > 0);
- assert(conversions == 0);
assert(c.count(SearchedType<int>(3, &conversions)) == 0);
assert(conversions == 0);
}
-template <typename Container, typename... Args>
-void test_non_transparent_count(Args&&... args) {
- Container c{std::forward<Args>(args)...};
+template<class Container>
+void test_non_transparent_count(Container c) {
int conversions = 0;
assert(c.count(SearchedType<int>(1, &conversions)) > 0);
- assert(conversions > 0);
- conversions = 0;
+ assert(conversions == 1);
assert(c.count(SearchedType<int>(2, &conversions)) > 0);
- assert(conversions > 0);
- conversions = 0;
+ assert(conversions == 2);
assert(c.count(SearchedType<int>(3, &conversions)) == 0);
- assert(conversions > 0);
+ assert(conversions == 3);
}
-template <typename Container, typename... Args>
-void test_transparent_contains(Args&&... args) {
- Container c{std::forward<Args>(args)...};
+template<class Container>
+void test_transparent_contains(Container c) {
int conversions = 0;
assert(c.contains(SearchedType<int>(1, &conversions)));
assert(c.contains(SearchedType<int>(2, &conversions)));
- assert(conversions == 0);
assert(!c.contains(SearchedType<int>(3, &conversions)));
assert(conversions == 0);
}
-template <typename Container, typename... Args>
-void test_non_transparent_contains(Args&&... args) {
- Container c{std::forward<Args>(args)...};
+template<class Container>
+void test_non_transparent_contains(Container c) {
int conversions = 0;
assert(c.contains(SearchedType<int>(1, &conversions)));
- assert(conversions > 0);
- conversions = 0;
+ assert(conversions == 1);
assert(c.contains(SearchedType<int>(2, &conversions)));
- assert(conversions > 0);
- conversions = 0;
+ assert(conversions == 2);
assert(!c.contains(SearchedType<int>(3, &conversions)));
- assert(conversions > 0);
+ assert(conversions == 3);
}
-template <typename Container, typename... Args>
-void test_transparent_equal_range(Args&&... args) {
- Container c{std::forward<Args>(args)...};
+template<class Container>
+void test_transparent_equal_range(Container c) {
int conversions = 0;
auto iters = c.equal_range(SearchedType<int>(1, &conversions));
assert(std::distance(iters.first, iters.second) > 0);
iters = c.equal_range(SearchedType<int>(2, &conversions));
assert(std::distance(iters.first, iters.second) > 0);
- assert(conversions == 0);
iters = c.equal_range(SearchedType<int>(3, &conversions));
assert(std::distance(iters.first, iters.second) == 0);
assert(conversions == 0);
}
-template <typename Container, typename... Args>
-void test_non_transparent_equal_range(Args&&... args) {
- Container c{std::forward<Args>(args)...};
+template<class Container>
+void test_non_transparent_equal_range(Container c) {
int conversions = 0;
auto iters = c.equal_range(SearchedType<int>(1, &conversions));
assert(std::distance(iters.first, iters.second) > 0);
- assert(conversions > 0);
- conversions = 0;
+ assert(conversions == 1);
iters = c.equal_range(SearchedType<int>(2, &conversions));
assert(std::distance(iters.first, iters.second) > 0);
- assert(conversions > 0);
- conversions = 0;
+ assert(conversions == 2);
iters = c.equal_range(SearchedType<int>(3, &conversions));
assert(std::distance(iters.first, iters.second) == 0);
- assert(conversions > 0);
+ assert(conversions == 3);
}
#endif // TEST_STD_VER > 17
More information about the libcxx-commits
mailing list