Deduction guides for associative containers, debug mode deduction guide fixes.

* include/bits/stl_iterator.h (__iter_key_t)
(__iter_val_t, __iter_to_alloc_t): New.
* include/bits/stl_map.h: Add deduction guides.
* include/bits/stl_multimap.h: Likewise.
* include/bits/stl_multiset.h: Likewise.
* include/bits/stl_set.h: Likewise.
* include/bits/unordered_map.h: Likewise.
* include/bits/unordered_set.h: Likewise.
* include/debug/deque: Likewise.
* include/debug/forward_list: Likewise.
* include/debug/list: Likewise.
* include/debug/map.h: Likewise.
* include/debug/multimap.h: Likewise.
* include/debug/multiset.h: Likewise.
* include/debug/set.h: Likewise.
* include/debug/unordered_map: Likewise.
* include/debug/unordered_set: Likewise.
* include/debug/vector: Likewise.
* testsuite/23_containers/map/cons/deduction.cc: New.
* testsuite/23_containers/multimap/cons/deduction.cc: Likewise.
* testsuite/23_containers/multiset/cons/deduction.cc: Likewise.
* testsuite/23_containers/set/cons/deduction.cc: Likewise.
* testsuite/23_containers/unordered_map/cons/deduction.cc: Likewise.
* testsuite/23_containers/unordered_multimap/cons/deduction.cc:
Likewise.
* testsuite/23_containers/unordered_multiset/cons/deduction.cc:
Likewise.
* testsuite/23_containers/unordered_set/cons/deduction.cc: Likewise.

From-SVN: r254113
This commit is contained in:
Ville Voutilainen 2017-10-26 19:42:31 +03:00 committed by Ville Voutilainen
parent 1f7bffd094
commit 957f5feacf
26 changed files with 1524 additions and 0 deletions

View File

@ -1,3 +1,36 @@
2017-10-26 Ville Voutilainen <ville.voutilainen@gmail.com>
Deduction guides for associative containers, debug mode deduction
guide fixes.
* include/bits/stl_iterator.h (__iter_key_t)
(__iter_val_t, __iter_to_alloc_t): New.
* include/bits/stl_map.h: Add deduction guides.
* include/bits/stl_multimap.h: Likewise.
* include/bits/stl_multiset.h: Likewise.
* include/bits/stl_set.h: Likewise.
* include/bits/unordered_map.h: Likewise.
* include/bits/unordered_set.h: Likewise.
* include/debug/deque: Likewise.
* include/debug/forward_list: Likewise.
* include/debug/list: Likewise.
* include/debug/map.h: Likewise.
* include/debug/multimap.h: Likewise.
* include/debug/multiset.h: Likewise.
* include/debug/set.h: Likewise.
* include/debug/unordered_map: Likewise.
* include/debug/unordered_set: Likewise.
* include/debug/vector: Likewise.
* testsuite/23_containers/map/cons/deduction.cc: New.
* testsuite/23_containers/multimap/cons/deduction.cc: Likewise.
* testsuite/23_containers/multiset/cons/deduction.cc: Likewise.
* testsuite/23_containers/set/cons/deduction.cc: Likewise.
* testsuite/23_containers/unordered_map/cons/deduction.cc: Likewise.
* testsuite/23_containers/unordered_multimap/cons/deduction.cc:
Likewise.
* testsuite/23_containers/unordered_multiset/cons/deduction.cc:
Likewise.
* testsuite/23_containers/unordered_set/cons/deduction.cc: Likewise.
2017-10-25 Jonathan Wakely <jwakely@redhat.com>
* doc/xml/manual/status_cxx2017.xml: Update C++17 status, and

View File

@ -1244,6 +1244,27 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#define _GLIBCXX_MAKE_MOVE_IF_NOEXCEPT_ITERATOR(_Iter) (_Iter)
#endif // C++11
#if __cpp_deduction_guides >= 201606
// These helper traits are used for deduction guides
// of associative containers.
template<typename _InputIterator>
using __iter_key_t = remove_const_t<
typename iterator_traits<_InputIterator>::value_type::first_type>;
template<typename _InputIterator>
using __iter_val_t =
typename iterator_traits<_InputIterator>::value_type::second_type;
template<typename _T1, typename _T2>
struct pair;
template<typename _InputIterator>
using __iter_to_alloc_t =
pair<add_const_t<__iter_key_t<_InputIterator>>,
__iter_val_t<_InputIterator>>;
#endif
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace

View File

@ -1381,6 +1381,40 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
const map<_K1, _T1, _C1, _A1>&);
};
#if __cpp_deduction_guides >= 201606
template<typename _InputIterator,
typename _Compare = less<__iter_key_t<_InputIterator>>,
typename _Allocator = allocator<__iter_to_alloc_t<_InputIterator>>,
typename = _RequireInputIter<_InputIterator>,
typename = _RequireAllocator<_Allocator>>
map(_InputIterator, _InputIterator,
_Compare = _Compare(), _Allocator = _Allocator())
-> map<__iter_key_t<_InputIterator>, __iter_val_t<_InputIterator>,
_Compare, _Allocator>;
template<typename _Key, typename _Tp, typename _Compare = less<_Key>,
typename _Allocator = allocator<pair<const _Key, _Tp>>,
typename = _RequireAllocator<_Allocator>>
map(initializer_list<pair<_Key, _Tp>>,
_Compare = _Compare(), _Allocator = _Allocator())
-> map<_Key, _Tp, _Compare, _Allocator>;
template <typename _InputIterator, typename _Allocator,
typename = _RequireInputIter<_InputIterator>,
typename = _RequireAllocator<_Allocator>>
map(_InputIterator, _InputIterator, _Allocator)
-> map<__iter_key_t<_InputIterator>, __iter_val_t<_InputIterator>,
less<__iter_key_t<_InputIterator>>, _Allocator>;
template<typename _Key, typename _Tp, typename _Allocator,
typename = _RequireAllocator<_Allocator>>
map(initializer_list<pair<_Key, _Tp>>, _Allocator)
-> map<_Key, _Tp, less<_Key>, _Allocator>;
#endif
/**
* @brief Map equality comparison.
* @param __x A %map.

View File

@ -1047,6 +1047,39 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
const multimap<_K1, _T1, _C1, _A1>&);
};
#if __cpp_deduction_guides >= 201606
template<typename _InputIterator,
typename _Compare = less<__iter_key_t<_InputIterator>>,
typename _Allocator = allocator<__iter_to_alloc_t<_InputIterator>>,
typename = _RequireInputIter<_InputIterator>,
typename = _RequireAllocator<_Allocator>>
multimap(_InputIterator, _InputIterator,
_Compare = _Compare(), _Allocator = _Allocator())
-> multimap<__iter_key_t<_InputIterator>, __iter_val_t<_InputIterator>,
_Compare, _Allocator>;
template<typename _Key, typename _Tp, typename _Compare = less<_Key>,
typename _Allocator = allocator<pair<const _Key, _Tp>>,
typename = _RequireAllocator<_Allocator>>
multimap(initializer_list<pair<_Key, _Tp>>,
_Compare = _Compare(), _Allocator = _Allocator())
-> multimap<_Key, _Tp, _Compare, _Allocator>;
template<typename _InputIterator, typename _Allocator,
typename = _RequireInputIter<_InputIterator>,
typename = _RequireAllocator<_Allocator>>
multimap(_InputIterator, _InputIterator, _Allocator)
-> multimap<__iter_key_t<_InputIterator>, __iter_val_t<_InputIterator>,
less<__iter_key_t<_InputIterator>>, _Allocator>;
template<typename _Key, typename _Tp, typename _Allocator,
typename = _RequireAllocator<_Allocator>>
multimap(initializer_list<pair<_Key, _Tp>>, _Allocator)
-> multimap<_Key, _Tp, less<_Key>, _Allocator>;
#endif
/**
* @brief Multimap equality comparison.
* @param __x A %multimap.

View File

@ -881,6 +881,43 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
const multiset<_K1, _C1, _A1>&);
};
#if __cpp_deduction_guides >= 201606
template<typename _InputIterator,
typename _Compare =
less<typename iterator_traits<_InputIterator>::value_type>,
typename _Allocator =
allocator<typename iterator_traits<_InputIterator>::value_type>,
typename = _RequireInputIter<_InputIterator>,
typename = _RequireAllocator<_Allocator>>
multiset(_InputIterator, _InputIterator,
_Compare = _Compare(), _Allocator = _Allocator())
-> multiset<typename iterator_traits<_InputIterator>::value_type,
_Compare, _Allocator>;
template<typename _Key,
typename _Compare = less<_Key>,
typename _Allocator = allocator<_Key>,
typename = _RequireAllocator<_Allocator>>
multiset(initializer_list<_Key>,
_Compare = _Compare(), _Allocator = _Allocator())
-> multiset<_Key, _Compare, _Allocator>;
template<typename _InputIterator, typename _Allocator,
typename = _RequireInputIter<_InputIterator>,
typename = _RequireAllocator<_Allocator>>
multiset(_InputIterator, _InputIterator, _Allocator)
-> multiset<typename iterator_traits<_InputIterator>::value_type,
less<typename iterator_traits<_InputIterator>::value_type>,
_Allocator>;
template<typename _Key, typename _Allocator,
typename = _RequireAllocator<_Allocator>>
multiset(initializer_list<_Key>, _Allocator)
-> multiset<_Key, less<_Key>, _Allocator>;
#endif
/**
* @brief Multiset equality comparison.
* @param __x A %multiset.
@ -971,6 +1008,7 @@ _GLIBCXX_END_NAMESPACE_CONTAINER
_S_get_tree(_GLIBCXX_STD_C::multiset<_Val, _Cmp2, _Alloc>& __set)
{ return __set._M_t; }
};
#endif // C++17
_GLIBCXX_END_NAMESPACE_VERSION

View File

@ -898,6 +898,41 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
operator<(const set<_K1, _C1, _A1>&, const set<_K1, _C1, _A1>&);
};
#if __cpp_deduction_guides >= 201606
template<typename _InputIterator,
typename _Compare =
less<typename iterator_traits<_InputIterator>::value_type>,
typename _Allocator =
allocator<typename iterator_traits<_InputIterator>::value_type>,
typename = _RequireInputIter<_InputIterator>,
typename = _RequireAllocator<_Allocator>>
set(_InputIterator, _InputIterator,
_Compare = _Compare(), _Allocator = _Allocator())
-> set<typename iterator_traits<_InputIterator>::value_type,
_Compare, _Allocator>;
template<typename _Key, typename _Compare = less<_Key>,
typename _Allocator = allocator<_Key>,
typename = _RequireAllocator<_Allocator>>
set(initializer_list<_Key>,
_Compare = _Compare(), _Allocator = _Allocator())
-> set<_Key, _Compare, _Allocator>;
template<typename _InputIterator, typename _Allocator,
typename = _RequireInputIter<_InputIterator>,
typename = _RequireAllocator<_Allocator>>
set(_InputIterator, _InputIterator, _Allocator)
-> set<typename iterator_traits<_InputIterator>::value_type,
less<typename iterator_traits<_InputIterator>::value_type>,
_Allocator>;
template<typename _Key, typename _Allocator,
typename = _RequireAllocator<_Allocator>>
set(initializer_list<_Key>, _Allocator)
-> set<_Key, less<_Key>, _Allocator>;
#endif
/**
* @brief Set equality comparison.

View File

@ -1130,6 +1130,82 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
const unordered_map<_Key1, _Tp1, _Hash1, _Pred1, _Alloc1>&);
};
#if __cpp_deduction_guides >= 201606
template<typename _InputIterator,
typename _Hash = hash<__iter_key_t<_InputIterator>>,
typename _Pred = equal_to<__iter_key_t<_InputIterator>>,
typename _Allocator = allocator<__iter_to_alloc_t<_InputIterator>>,
typename = _RequireInputIter<_InputIterator>,
typename = _RequireAllocator<_Allocator>>
unordered_map(_InputIterator, _InputIterator,
typename unordered_map<int, int>::size_type = {},
_Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
-> unordered_map<__iter_key_t<_InputIterator>,
__iter_val_t<_InputIterator>,
_Hash, _Pred, _Allocator>;
template<typename _Key, typename _Tp, typename _Hash = hash<_Key>,
typename _Pred = equal_to<_Key>,
typename _Allocator = allocator<pair<const _Key, _Tp>>,
typename = _RequireAllocator<_Allocator>>
unordered_map(initializer_list<pair<_Key, _Tp>>,
typename unordered_map<int, int>::size_type = {},
_Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
-> unordered_map<_Key, _Tp, _Hash, _Pred, _Allocator>;
template<typename _InputIterator, typename _Allocator,
typename = _RequireInputIter<_InputIterator>,
typename = _RequireAllocator<_Allocator>>
unordered_map(_InputIterator, _InputIterator,
typename unordered_map<int, int>::size_type, _Allocator)
-> unordered_map<__iter_key_t<_InputIterator>,
__iter_val_t<_InputIterator>,
hash<__iter_key_t<_InputIterator>>,
equal_to<__iter_key_t<_InputIterator>>,
_Allocator>;
template<typename _InputIterator, typename _Allocator,
typename = _RequireInputIter<_InputIterator>,
typename = _RequireAllocator<_Allocator>>
unordered_map(_InputIterator, _InputIterator, _Allocator)
-> unordered_map<__iter_key_t<_InputIterator>,
__iter_val_t<_InputIterator>,
hash<__iter_key_t<_InputIterator>>,
equal_to<__iter_key_t<_InputIterator>>,
_Allocator>;
template<typename _InputIterator, typename _Hash, typename _Allocator,
typename = _RequireInputIter<_InputIterator>,
typename = _RequireAllocator<_Allocator>>
unordered_map(_InputIterator, _InputIterator,
typename unordered_map<int, int>::size_type,
_Hash, _Allocator)
-> unordered_map<__iter_key_t<_InputIterator>,
__iter_val_t<_InputIterator>, _Hash,
equal_to<__iter_key_t<_InputIterator>>, _Allocator>;
template<typename _Key, typename _Tp, typename _Allocator,
typename = _RequireAllocator<_Allocator>>
unordered_map(initializer_list<pair<_Key, _Tp>>,
typename unordered_map<int, int>::size_type,
_Allocator)
-> unordered_map<_Key, _Tp, hash<_Key>, equal_to<_Key>, _Allocator>;
template<typename _Key, typename _Tp, typename _Allocator,
_RequireAllocator<_Allocator>>
unordered_map(initializer_list<pair<_Key, _Tp>>, _Allocator)
-> unordered_map<_Key, _Tp, hash<_Key>, equal_to<_Key>, _Allocator>;
template<typename _Key, typename _Tp, typename _Hash, typename _Allocator,
typename = _RequireAllocator<_Allocator>>
unordered_map(initializer_list<pair<_Key, _Tp>>,
typename unordered_map<int, int>::size_type,
_Hash, _Allocator)
-> unordered_map<_Key, _Tp, _Hash, equal_to<_Key>, _Allocator>;
#endif
/**
* @brief A standard container composed of equivalent keys
* (possibly containing multiple of each key value) that associates
@ -1893,6 +1969,82 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
_Hash1, _Pred1, _Alloc1>&);
};
#if __cpp_deduction_guides >= 201606
template<typename _InputIterator,
typename _Hash = hash<__iter_key_t<_InputIterator>>,
typename _Pred = equal_to<__iter_key_t<_InputIterator>>,
typename _Allocator = allocator<__iter_to_alloc_t<_InputIterator>>,
typename = _RequireInputIter<_InputIterator>,
typename = _RequireAllocator<_Allocator>>
unordered_multimap(_InputIterator, _InputIterator,
unordered_multimap<int, int>::size_type = {},
_Hash = _Hash(), _Pred = _Pred(),
_Allocator = _Allocator())
-> unordered_multimap<__iter_key_t<_InputIterator>,
__iter_val_t<_InputIterator>, _Hash, _Pred,
_Allocator>;
template<typename _Key, typename _Tp, typename _Hash = hash<_Key>,
typename _Pred = equal_to<_Key>,
typename _Allocator = allocator<pair<const _Key, _Tp>>,
typename = _RequireAllocator<_Allocator>>
unordered_multimap(initializer_list<pair<_Key, _Tp>>,
unordered_multimap<int, int>::size_type = {},
_Hash = _Hash(), _Pred = _Pred(),
_Allocator = _Allocator())
-> unordered_multimap<_Key, _Tp, _Hash, _Pred, _Allocator>;
template<typename _InputIterator, typename _Allocator,
typename = _RequireInputIter<_InputIterator>,
typename = _RequireAllocator<_Allocator>>
unordered_multimap(_InputIterator, _InputIterator,
unordered_multimap<int, int>::size_type, _Allocator)
-> unordered_multimap<__iter_key_t<_InputIterator>,
__iter_val_t<_InputIterator>,
hash<__iter_key_t<_InputIterator>>,
equal_to<__iter_key_t<_InputIterator>>, _Allocator>;
template<typename _InputIterator, typename _Allocator,
typename = _RequireInputIter<_InputIterator>,
typename = _RequireAllocator<_Allocator>>
unordered_multimap(_InputIterator, _InputIterator, _Allocator)
-> unordered_multimap<__iter_key_t<_InputIterator>,
__iter_val_t<_InputIterator>,
hash<__iter_key_t<_InputIterator>>,
equal_to<__iter_key_t<_InputIterator>>, _Allocator>;
template<typename _InputIterator, typename _Hash, typename _Allocator,
typename = _RequireInputIter<_InputIterator>,
typename = _RequireAllocator<_Allocator>>
unordered_multimap(_InputIterator, _InputIterator,
unordered_multimap<int, int>::size_type, _Hash,
_Allocator)
-> unordered_multimap<__iter_key_t<_InputIterator>,
__iter_val_t<_InputIterator>, _Hash,
equal_to<__iter_key_t<_InputIterator>>, _Allocator>;
template<typename _Key, typename _Tp, typename _Allocator,
typename = _RequireAllocator<_Allocator>>
unordered_multimap(initializer_list<pair<_Key, _Tp>>,
unordered_multimap<int, int>::size_type,
_Allocator)
-> unordered_multimap<_Key, _Tp, hash<_Key>, equal_to<_Key>, _Allocator>;
template<typename _Key, typename _Tp, typename _Allocator,
typename = _RequireAllocator<_Allocator>>
unordered_multimap(initializer_list<pair<_Key, _Tp>>, _Allocator)
-> unordered_multimap<_Key, _Tp, hash<_Key>, equal_to<_Key>, _Allocator>;
template<typename _Key, typename _Tp, typename _Hash, typename _Allocator,
typename = _RequireAllocator<_Allocator>>
unordered_multimap(initializer_list<pair<_Key, _Tp>>,
unordered_multimap<int, int>::size_type,
_Hash, _Allocator)
-> unordered_multimap<_Key, _Tp, _Hash, equal_to<_Key>, _Allocator>;
#endif
template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
inline void
swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,

View File

@ -805,6 +805,70 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
const unordered_set<_Value1, _Hash1, _Pred1, _Alloc1>&);
};
#if __cpp_deduction_guides >= 201606
template<typename _InputIterator,
typename _Hash =
hash<typename iterator_traits<_InputIterator>::value_type>,
typename _Pred =
equal_to<typename iterator_traits<_InputIterator>::value_type>,
typename _Allocator =
allocator<typename iterator_traits<_InputIterator>::value_type>,
typename = _RequireInputIter<_InputIterator>,
typename = _RequireAllocator<_Allocator>>
unordered_set(_InputIterator, _InputIterator,
unordered_set<int>::size_type = {},
_Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
-> unordered_set<typename iterator_traits<_InputIterator>::value_type,
_Hash, _Pred, _Allocator>;
template<typename _Tp, typename _Hash = hash<_Tp>,
typename _Pred = equal_to<_Tp>,
typename _Allocator = allocator<_Tp>,
typename = _RequireAllocator<_Allocator>>
unordered_set(initializer_list<_Tp>,
unordered_set<int>::size_type = {},
_Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
-> unordered_set<_Tp, _Hash, _Pred, _Allocator>;
template<typename _InputIterator, typename _Allocator,
typename = _RequireInputIter<_InputIterator>,
typename = _RequireAllocator<_Allocator>>
unordered_set(_InputIterator, _InputIterator,
unordered_set<int>::size_type, _Allocator)
-> unordered_set<typename iterator_traits<_InputIterator>::value_type,
hash<
typename iterator_traits<_InputIterator>::value_type>,
equal_to<
typename iterator_traits<_InputIterator>::value_type>,
_Allocator>;
template<typename _InputIterator, typename _Hash, typename _Allocator,
typename = _RequireInputIter<_InputIterator>,
typename = _RequireAllocator<_Allocator>>
unordered_set(_InputIterator, _InputIterator,
unordered_set<int>::size_type,
_Hash, _Allocator)
-> unordered_set<typename iterator_traits<_InputIterator>::value_type,
_Hash,
equal_to<
typename iterator_traits<_InputIterator>::value_type>,
_Allocator>;
template<typename _Tp, typename _Allocator,
typename = _RequireAllocator<_Allocator>>
unordered_set(initializer_list<_Tp>,
unordered_set<int>::size_type, _Allocator)
-> unordered_set<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>;
template<typename _Tp, typename _Hash, typename _Allocator,
typename = _RequireAllocator<_Allocator>>
unordered_set(initializer_list<_Tp>,
unordered_set<int>::size_type, _Hash, _Allocator)
-> unordered_set<_Tp, _Hash, equal_to<_Tp>, _Allocator>;
#endif
/**
* @brief A standard container composed of equivalent keys
* (possibly containing multiple of each key value) in which the
@ -1517,6 +1581,75 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
const unordered_multiset<_Value1, _Hash1, _Pred1, _Alloc1>&);
};
#if __cpp_deduction_guides >= 201606
template<typename _InputIterator,
typename _Hash =
hash<typename iterator_traits<_InputIterator>::value_type>,
typename _Pred =
equal_to<typename iterator_traits<_InputIterator>::value_type>,
typename _Allocator =
allocator<typename iterator_traits<_InputIterator>::value_type>,
typename = _RequireInputIter<_InputIterator>,
typename = _RequireAllocator<_Allocator>>
unordered_multiset(_InputIterator, _InputIterator,
unordered_multiset<int>::size_type = {},
_Hash = _Hash(), _Pred = _Pred(),
_Allocator = _Allocator())
-> unordered_multiset<typename iterator_traits<_InputIterator>::value_type,
_Hash, _Pred, _Allocator>;
template<typename _Tp, typename _Hash = hash<_Tp>,
typename _Pred = equal_to<_Tp>,
typename _Allocator = allocator<_Tp>,
typename = _RequireAllocator<_Allocator>>
unordered_multiset(initializer_list<_Tp>,
unordered_multiset<int>::size_type = {},
_Hash = _Hash(), _Pred = _Pred(),
_Allocator = _Allocator())
-> unordered_multiset<_Tp, _Hash, _Pred, _Allocator>;
template<typename _InputIterator, typename _Allocator,
typename = _RequireInputIter<_InputIterator>,
typename = _RequireAllocator<_Allocator>>
unordered_multiset(_InputIterator, _InputIterator,
unordered_multiset<int>::size_type, _Allocator)
-> unordered_multiset<typename iterator_traits<_InputIterator>::value_type,
hash<typename
iterator_traits<_InputIterator>::value_type>,
equal_to<typename
iterator_traits<_InputIterator>::value_type>,
_Allocator>;
template<typename _InputIterator, typename _Hash, typename _Allocator,
typename = _RequireInputIter<_InputIterator>,
typename = _RequireAllocator<_Allocator>>
unordered_multiset(_InputIterator, _InputIterator,
unordered_multiset<int>::size_type,
_Hash, _Allocator)
-> unordered_multiset<typename
iterator_traits<_InputIterator>::value_type,
_Hash,
equal_to<
typename
iterator_traits<_InputIterator>::value_type>,
_Allocator>;
template<typename _Tp, typename _Allocator,
typename = _RequireAllocator<_Allocator>>
unordered_multiset(initializer_list<_Tp>,
unordered_multiset<int>::size_type, _Allocator)
-> unordered_multiset<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>;
template<typename _Tp, typename _Hash, typename _Allocator,
typename = _RequireAllocator<_Allocator>>
unordered_multiset(initializer_list<_Tp>,
unordered_multiset<int>::size_type, _Hash, _Allocator)
-> unordered_multiset<_Tp, _Hash, equal_to<_Tp>, _Allocator>;
#endif
template<class _Value, class _Hash, class _Pred, class _Alloc>
inline void
swap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,

View File

@ -624,6 +624,16 @@ namespace __debug
_M_base() const _GLIBCXX_NOEXCEPT { return *this; }
};
#if __cpp_deduction_guides >= 201606
template<typename _InputIterator, typename _ValT
= typename iterator_traits<_InputIterator>::value_type,
typename _Allocator = allocator<_ValT>,
typename = _RequireInputIter<_InputIterator>,
typename = _RequireAllocator<_Allocator>>
deque(_InputIterator, _InputIterator, _Allocator = _Allocator())
-> deque<_ValT, _Allocator>;
#endif
template<typename _Tp, typename _Alloc>
inline bool
operator==(const deque<_Tp, _Alloc>& __lhs,

View File

@ -772,6 +772,16 @@ namespace __debug
_M_base() const noexcept { return *this; }
};
#if __cpp_deduction_guides >= 201606
template<typename _InputIterator, typename _ValT
= typename iterator_traits<_InputIterator>::value_type,
typename _Allocator = allocator<_ValT>,
typename = _RequireInputIter<_InputIterator>,
typename = _RequireAllocator<_Allocator>>
forward_list(_InputIterator, _InputIterator, _Allocator = _Allocator())
-> forward_list<_ValT, _Allocator>;
#endif
template<typename _Tp, typename _Alloc>
bool
operator==(const forward_list<_Tp, _Alloc>& __lx,

View File

@ -769,6 +769,16 @@ namespace __debug
_M_base() const _GLIBCXX_NOEXCEPT { return *this; }
};
#if __cpp_deduction_guides >= 201606
template<typename _InputIterator, typename _ValT
= typename iterator_traits<_InputIterator>::value_type,
typename _Allocator = allocator<_ValT>,
typename = _RequireInputIter<_InputIterator>,
typename = _RequireAllocator<_Allocator>>
list(_InputIterator, _InputIterator, _Allocator = _Allocator())
-> list<_ValT, _Allocator>;
#endif
template<typename _Tp, typename _Alloc>
inline bool
operator==(const list<_Tp, _Alloc>& __lhs,

View File

@ -667,6 +667,39 @@ namespace __debug
_M_base() const _GLIBCXX_NOEXCEPT { return *this; }
};
#if __cpp_deduction_guides >= 201606
template<typename _InputIterator,
typename _Compare = less<__iter_key_t<_InputIterator>>,
typename _Allocator = allocator<__iter_to_alloc_t<_InputIterator>>,
typename = _RequireInputIter<_InputIterator>,
typename = _RequireAllocator<_Allocator>>
map(_InputIterator, _InputIterator,
_Compare = _Compare(), _Allocator = _Allocator())
-> map<__iter_key_t<_InputIterator>, __iter_val_t<_InputIterator>,
_Compare, _Allocator>;
template<typename _Key, typename _Tp, typename _Compare = less<_Key>,
typename _Allocator = allocator<pair<const _Key, _Tp>>,
typename = _RequireAllocator<_Allocator>>
map(initializer_list<pair<_Key, _Tp>>,
_Compare = _Compare(), _Allocator = _Allocator())
-> map<_Key, _Tp, _Compare, _Allocator>;
template <typename _InputIterator, typename _Allocator,
typename = _RequireInputIter<_InputIterator>,
typename = _RequireAllocator<_Allocator>>
map(_InputIterator, _InputIterator, _Allocator)
-> map<__iter_key_t<_InputIterator>, __iter_val_t<_InputIterator>,
less<__iter_key_t<_InputIterator>>, _Allocator>;
template<typename _Key, typename _Tp, typename _Allocator,
typename = _RequireAllocator<_Allocator>>
map(initializer_list<pair<_Key, _Tp>>, _Allocator)
-> map<_Key, _Tp, less<_Key>, _Allocator>;
#endif
template<typename _Key, typename _Tp,
typename _Compare, typename _Allocator>
inline bool

View File

@ -555,6 +555,39 @@ namespace __debug
_M_base() const _GLIBCXX_NOEXCEPT { return *this; }
};
#if __cpp_deduction_guides >= 201606
template<typename _InputIterator,
typename _Compare = less<__iter_key_t<_InputIterator>>,
typename _Allocator = allocator<__iter_to_alloc_t<_InputIterator>>,
typename = _RequireInputIter<_InputIterator>,
typename = _RequireAllocator<_Allocator>>
multimap(_InputIterator, _InputIterator,
_Compare = _Compare(), _Allocator = _Allocator())
-> multimap<__iter_key_t<_InputIterator>, __iter_val_t<_InputIterator>,
_Compare, _Allocator>;
template<typename _Key, typename _Tp, typename _Compare = less<_Key>,
typename _Allocator = allocator<pair<const _Key, _Tp>>,
typename = _RequireAllocator<_Allocator>>
multimap(initializer_list<pair<_Key, _Tp>>,
_Compare = _Compare(), _Allocator = _Allocator())
-> multimap<_Key, _Tp, _Compare, _Allocator>;
template<typename _InputIterator, typename _Allocator,
typename = _RequireInputIter<_InputIterator>,
typename = _RequireAllocator<_Allocator>>
multimap(_InputIterator, _InputIterator, _Allocator)
-> multimap<__iter_key_t<_InputIterator>, __iter_val_t<_InputIterator>,
less<__iter_key_t<_InputIterator>>, _Allocator>;
template<typename _Key, typename _Tp, typename _Allocator,
typename = _RequireAllocator<_Allocator>>
multimap(initializer_list<pair<_Key, _Tp>>, _Allocator)
-> multimap<_Key, _Tp, less<_Key>, _Allocator>;
#endif
template<typename _Key, typename _Tp,
typename _Compare, typename _Allocator>
inline bool

View File

@ -542,6 +542,43 @@ namespace __debug
_M_base() const _GLIBCXX_NOEXCEPT { return *this; }
};
#if __cpp_deduction_guides >= 201606
template<typename _InputIterator,
typename _Compare =
less<typename iterator_traits<_InputIterator>::value_type>,
typename _Allocator =
allocator<typename iterator_traits<_InputIterator>::value_type>,
typename = _RequireInputIter<_InputIterator>,
typename = _RequireAllocator<_Allocator>>
multiset(_InputIterator, _InputIterator,
_Compare = _Compare(), _Allocator = _Allocator())
-> multiset<typename iterator_traits<_InputIterator>::value_type,
_Compare, _Allocator>;
template<typename _Key,
typename _Compare = less<_Key>,
typename _Allocator = allocator<_Key>,
typename = _RequireAllocator<_Allocator>>
multiset(initializer_list<_Key>,
_Compare = _Compare(), _Allocator = _Allocator())
-> multiset<_Key, _Compare, _Allocator>;
template<typename _InputIterator, typename _Allocator,
typename = _RequireInputIter<_InputIterator>,
typename = _RequireAllocator<_Allocator>>
multiset(_InputIterator, _InputIterator, _Allocator)
-> multiset<typename iterator_traits<_InputIterator>::value_type,
less<typename iterator_traits<_InputIterator>::value_type>,
_Allocator>;
template<typename _Key, typename _Allocator,
typename = _RequireAllocator<_Allocator>>
multiset(initializer_list<_Key>, _Allocator)
-> multiset<_Key, less<_Key>, _Allocator>;
#endif
template<typename _Key, typename _Compare, typename _Allocator>
inline bool
operator==(const multiset<_Key, _Compare, _Allocator>& __lhs,

View File

@ -560,6 +560,42 @@ namespace __debug
_M_base() const _GLIBCXX_NOEXCEPT { return *this; }
};
#if __cpp_deduction_guides >= 201606
template<typename _InputIterator,
typename _Compare =
less<typename iterator_traits<_InputIterator>::value_type>,
typename _Allocator =
allocator<typename iterator_traits<_InputIterator>::value_type>,
typename = _RequireInputIter<_InputIterator>,
typename = _RequireAllocator<_Allocator>>
set(_InputIterator, _InputIterator,
_Compare = _Compare(), _Allocator = _Allocator())
-> set<typename iterator_traits<_InputIterator>::value_type,
_Compare, _Allocator>;
template<typename _Key, typename _Compare = less<_Key>,
typename _Allocator = allocator<_Key>,
typename = _RequireAllocator<_Allocator>>
set(initializer_list<_Key>,
_Compare = _Compare(), _Allocator = _Allocator())
-> set<_Key, _Compare, _Allocator>;
template<typename _InputIterator, typename _Allocator,
typename = _RequireInputIter<_InputIterator>,
typename = _RequireAllocator<_Allocator>>
set(_InputIterator, _InputIterator, _Allocator)
-> set<typename iterator_traits<_InputIterator>::value_type,
less<typename iterator_traits<_InputIterator>::value_type>,
_Allocator>;
template<typename _Key, typename _Allocator,
typename = _RequireAllocator<_Allocator>>
set(initializer_list<_Key>, _Allocator)
-> set<_Key, less<_Key>, _Allocator>;
#endif
template<typename _Key, typename _Compare, typename _Allocator>
inline bool
operator==(const set<_Key, _Compare, _Allocator>& __lhs,

View File

@ -616,6 +616,82 @@ namespace __debug
}
};
#if __cpp_deduction_guides >= 201606
template<typename _InputIterator,
typename _Hash = hash<__iter_key_t<_InputIterator>>,
typename _Pred = equal_to<__iter_key_t<_InputIterator>>,
typename _Allocator = allocator<__iter_to_alloc_t<_InputIterator>>,
typename = _RequireInputIter<_InputIterator>,
typename = _RequireAllocator<_Allocator>>
unordered_map(_InputIterator, _InputIterator,
typename unordered_map<int, int>::size_type = {},
_Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
-> unordered_map<__iter_key_t<_InputIterator>,
__iter_val_t<_InputIterator>,
_Hash, _Pred, _Allocator>;
template<typename _Key, typename _Tp, typename _Hash = hash<_Key>,
typename _Pred = equal_to<_Key>,
typename _Allocator = allocator<pair<const _Key, _Tp>>,
typename = _RequireAllocator<_Allocator>>
unordered_map(initializer_list<pair<_Key, _Tp>>,
typename unordered_map<int, int>::size_type = {},
_Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
-> unordered_map<_Key, _Tp, _Hash, _Pred, _Allocator>;
template<typename _InputIterator, typename _Allocator,
typename = _RequireInputIter<_InputIterator>,
typename = _RequireAllocator<_Allocator>>
unordered_map(_InputIterator, _InputIterator,
typename unordered_map<int, int>::size_type, _Allocator)
-> unordered_map<__iter_key_t<_InputIterator>,
__iter_val_t<_InputIterator>,
hash<__iter_key_t<_InputIterator>>,
equal_to<__iter_key_t<_InputIterator>>,
_Allocator>;
template<typename _InputIterator, typename _Allocator,
typename = _RequireInputIter<_InputIterator>,
typename = _RequireAllocator<_Allocator>>
unordered_map(_InputIterator, _InputIterator, _Allocator)
-> unordered_map<__iter_key_t<_InputIterator>,
__iter_val_t<_InputIterator>,
hash<__iter_key_t<_InputIterator>>,
equal_to<__iter_key_t<_InputIterator>>,
_Allocator>;
template<typename _InputIterator, typename _Hash, typename _Allocator,
typename = _RequireInputIter<_InputIterator>,
typename = _RequireAllocator<_Allocator>>
unordered_map(_InputIterator, _InputIterator,
typename unordered_map<int, int>::size_type,
_Hash, _Allocator)
-> unordered_map<__iter_key_t<_InputIterator>,
__iter_val_t<_InputIterator>, _Hash,
equal_to<__iter_key_t<_InputIterator>>, _Allocator>;
template<typename _Key, typename _Tp, typename _Allocator,
typename = _RequireAllocator<_Allocator>>
unordered_map(initializer_list<pair<_Key, _Tp>>,
typename unordered_map<int, int>::size_type,
_Allocator)
-> unordered_map<_Key, _Tp, hash<_Key>, equal_to<_Key>, _Allocator>;
template<typename _Key, typename _Tp, typename _Allocator,
_RequireAllocator<_Allocator>>
unordered_map(initializer_list<pair<_Key, _Tp>>, _Allocator)
-> unordered_map<_Key, _Tp, hash<_Key>, equal_to<_Key>, _Allocator>;
template<typename _Key, typename _Tp, typename _Hash, typename _Allocator,
typename = _RequireAllocator<_Allocator>>
unordered_map(initializer_list<pair<_Key, _Tp>>,
typename unordered_map<int, int>::size_type,
_Hash, _Allocator)
-> unordered_map<_Key, _Tp, _Hash, equal_to<_Key>, _Allocator>;
#endif
template<typename _Key, typename _Tp, typename _Hash,
typename _Pred, typename _Alloc>
inline void
@ -1110,6 +1186,82 @@ namespace __debug
}
};
#if __cpp_deduction_guides >= 201606
template<typename _InputIterator,
typename _Hash = hash<__iter_key_t<_InputIterator>>,
typename _Pred = equal_to<__iter_key_t<_InputIterator>>,
typename _Allocator = allocator<__iter_to_alloc_t<_InputIterator>>,
typename = _RequireInputIter<_InputIterator>,
typename = _RequireAllocator<_Allocator>>
unordered_multimap(_InputIterator, _InputIterator,
unordered_multimap<int, int>::size_type = {},
_Hash = _Hash(), _Pred = _Pred(),
_Allocator = _Allocator())
-> unordered_multimap<__iter_key_t<_InputIterator>,
__iter_val_t<_InputIterator>, _Hash, _Pred,
_Allocator>;
template<typename _Key, typename _Tp, typename _Hash = hash<_Key>,
typename _Pred = equal_to<_Key>,
typename _Allocator = allocator<pair<const _Key, _Tp>>,
typename = _RequireAllocator<_Allocator>>
unordered_multimap(initializer_list<pair<_Key, _Tp>>,
unordered_multimap<int, int>::size_type = {},
_Hash = _Hash(), _Pred = _Pred(),
_Allocator = _Allocator())
-> unordered_multimap<_Key, _Tp, _Hash, _Pred, _Allocator>;
template<typename _InputIterator, typename _Allocator,
typename = _RequireInputIter<_InputIterator>,
typename = _RequireAllocator<_Allocator>>
unordered_multimap(_InputIterator, _InputIterator,
unordered_multimap<int, int>::size_type, _Allocator)
-> unordered_multimap<__iter_key_t<_InputIterator>,
__iter_val_t<_InputIterator>,
hash<__iter_key_t<_InputIterator>>,
equal_to<__iter_key_t<_InputIterator>>, _Allocator>;
template<typename _InputIterator, typename _Allocator,
typename = _RequireInputIter<_InputIterator>,
typename = _RequireAllocator<_Allocator>>
unordered_multimap(_InputIterator, _InputIterator, _Allocator)
-> unordered_multimap<__iter_key_t<_InputIterator>,
__iter_val_t<_InputIterator>,
hash<__iter_key_t<_InputIterator>>,
equal_to<__iter_key_t<_InputIterator>>, _Allocator>;
template<typename _InputIterator, typename _Hash, typename _Allocator,
typename = _RequireInputIter<_InputIterator>,
typename = _RequireAllocator<_Allocator>>
unordered_multimap(_InputIterator, _InputIterator,
unordered_multimap<int, int>::size_type, _Hash,
_Allocator)
-> unordered_multimap<__iter_key_t<_InputIterator>,
__iter_val_t<_InputIterator>, _Hash,
equal_to<__iter_key_t<_InputIterator>>, _Allocator>;
template<typename _Key, typename _Tp, typename _Allocator,
typename = _RequireAllocator<_Allocator>>
unordered_multimap(initializer_list<pair<_Key, _Tp>>,
unordered_multimap<int, int>::size_type,
_Allocator)
-> unordered_multimap<_Key, _Tp, hash<_Key>, equal_to<_Key>, _Allocator>;
template<typename _Key, typename _Tp, typename _Allocator,
typename = _RequireAllocator<_Allocator>>
unordered_multimap(initializer_list<pair<_Key, _Tp>>, _Allocator)
-> unordered_multimap<_Key, _Tp, hash<_Key>, equal_to<_Key>, _Allocator>;
template<typename _Key, typename _Tp, typename _Hash, typename _Allocator,
typename = _RequireAllocator<_Allocator>>
unordered_multimap(initializer_list<pair<_Key, _Tp>>,
unordered_multimap<int, int>::size_type,
_Hash, _Allocator)
-> unordered_multimap<_Key, _Tp, _Hash, equal_to<_Key>, _Allocator>;
#endif
template<typename _Key, typename _Tp, typename _Hash,
typename _Pred, typename _Alloc>
inline void

View File

@ -530,6 +530,70 @@ namespace __debug
}
};
#if __cpp_deduction_guides >= 201606
template<typename _InputIterator,
typename _Hash =
hash<typename iterator_traits<_InputIterator>::value_type>,
typename _Pred =
equal_to<typename iterator_traits<_InputIterator>::value_type>,
typename _Allocator =
allocator<typename iterator_traits<_InputIterator>::value_type>,
typename = _RequireInputIter<_InputIterator>,
typename = _RequireAllocator<_Allocator>>
unordered_set(_InputIterator, _InputIterator,
unordered_set<int>::size_type = {},
_Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
-> unordered_set<typename iterator_traits<_InputIterator>::value_type,
_Hash, _Pred, _Allocator>;
template<typename _Tp, typename _Hash = hash<_Tp>,
typename _Pred = equal_to<_Tp>,
typename _Allocator = allocator<_Tp>,
typename = _RequireAllocator<_Allocator>>
unordered_set(initializer_list<_Tp>,
unordered_set<int>::size_type = {},
_Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
-> unordered_set<_Tp, _Hash, _Pred, _Allocator>;
template<typename _InputIterator, typename _Allocator,
typename = _RequireInputIter<_InputIterator>,
typename = _RequireAllocator<_Allocator>>
unordered_set(_InputIterator, _InputIterator,
unordered_set<int>::size_type, _Allocator)
-> unordered_set<typename iterator_traits<_InputIterator>::value_type,
hash<
typename iterator_traits<_InputIterator>::value_type>,
equal_to<
typename iterator_traits<_InputIterator>::value_type>,
_Allocator>;
template<typename _InputIterator, typename _Hash, typename _Allocator,
typename = _RequireInputIter<_InputIterator>,
typename = _RequireAllocator<_Allocator>>
unordered_set(_InputIterator, _InputIterator,
unordered_set<int>::size_type,
_Hash, _Allocator)
-> unordered_set<typename iterator_traits<_InputIterator>::value_type,
_Hash,
equal_to<
typename iterator_traits<_InputIterator>::value_type>,
_Allocator>;
template<typename _Tp, typename _Allocator,
typename = _RequireAllocator<_Allocator>>
unordered_set(initializer_list<_Tp>,
unordered_set<int>::size_type, _Allocator)
-> unordered_set<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>;
template<typename _Tp, typename _Hash, typename _Allocator,
typename = _RequireAllocator<_Allocator>>
unordered_set(initializer_list<_Tp>,
unordered_set<int>::size_type, _Hash, _Allocator)
-> unordered_set<_Tp, _Hash, equal_to<_Tp>, _Allocator>;
#endif
template<typename _Value, typename _Hash, typename _Pred, typename _Alloc>
inline void
swap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
@ -1012,6 +1076,74 @@ namespace __debug
}
};
#if __cpp_deduction_guides >= 201606
template<typename _InputIterator,
typename _Hash =
hash<typename iterator_traits<_InputIterator>::value_type>,
typename _Pred =
equal_to<typename iterator_traits<_InputIterator>::value_type>,
typename _Allocator =
allocator<typename iterator_traits<_InputIterator>::value_type>,
typename = _RequireInputIter<_InputIterator>,
typename = _RequireAllocator<_Allocator>>
unordered_multiset(_InputIterator, _InputIterator,
unordered_multiset<int>::size_type = {},
_Hash = _Hash(), _Pred = _Pred(),
_Allocator = _Allocator())
-> unordered_multiset<typename iterator_traits<_InputIterator>::value_type,
_Hash, _Pred, _Allocator>;
template<typename _Tp, typename _Hash = hash<_Tp>,
typename _Pred = equal_to<_Tp>,
typename _Allocator = allocator<_Tp>,
typename = _RequireAllocator<_Allocator>>
unordered_multiset(initializer_list<_Tp>,
unordered_multiset<int>::size_type = {},
_Hash = _Hash(), _Pred = _Pred(),
_Allocator = _Allocator())
-> unordered_multiset<_Tp, _Hash, _Pred, _Allocator>;
template<typename _InputIterator, typename _Allocator,
typename = _RequireInputIter<_InputIterator>,
typename = _RequireAllocator<_Allocator>>
unordered_multiset(_InputIterator, _InputIterator,
unordered_multiset<int>::size_type, _Allocator)
-> unordered_multiset<typename iterator_traits<_InputIterator>::value_type,
hash<typename
iterator_traits<_InputIterator>::value_type>,
equal_to<typename
iterator_traits<_InputIterator>::value_type>,
_Allocator>;
template<typename _InputIterator, typename _Hash, typename _Allocator,
typename = _RequireInputIter<_InputIterator>,
typename = _RequireAllocator<_Allocator>>
unordered_multiset(_InputIterator, _InputIterator,
unordered_multiset<int>::size_type,
_Hash, _Allocator)
-> unordered_multiset<typename
iterator_traits<_InputIterator>::value_type,
_Hash,
equal_to<
typename
iterator_traits<_InputIterator>::value_type>,
_Allocator>;
template<typename _Tp, typename _Allocator,
typename = _RequireAllocator<_Allocator>>
unordered_multiset(initializer_list<_Tp>,
unordered_multiset<int>::size_type, _Allocator)
-> unordered_multiset<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>;
template<typename _Tp, typename _Hash, typename _Allocator,
typename = _RequireAllocator<_Allocator>>
unordered_multiset(initializer_list<_Tp>,
unordered_multiset<int>::size_type, _Hash, _Allocator)
-> unordered_multiset<_Tp, _Hash, equal_to<_Tp>, _Allocator>;
#endif
template<typename _Value, typename _Hash, typename _Pred, typename _Alloc>
inline void
swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,

View File

@ -757,6 +757,16 @@ namespace __debug
_GLIBCXX_NOEXCEPT_IF(noexcept(__lhs.swap(__rhs)))
{ __lhs.swap(__rhs); }
#if __cpp_deduction_guides >= 201606
template<typename _InputIterator, typename _ValT
= typename iterator_traits<_InputIterator>::value_type,
typename _Allocator = allocator<_ValT>,
typename = _RequireInputIter<_InputIterator>,
typename = _RequireAllocator<_Allocator>>
vector(_InputIterator, _InputIterator, _Allocator = _Allocator())
-> vector<_ValT, _Allocator>;
#endif
} // namespace __debug
#if __cplusplus >= 201103L

View File

@ -0,0 +1,68 @@
// { dg-options "-std=gnu++17" }
// { dg-do compile { target c++17 } }
#include <map>
#include <testsuite_allocator.h>
using __gnu_test::SimpleAllocator;
static_assert(std::is_same_v<
decltype(std::map{std::pair{1, 2.0}, {2, 3.0}, {3, 4.0}}),
std::map<int, double>>);
static_assert(std::is_same_v<
decltype(std::map{{std::pair{1, 2.0}, {2, 3.0}, {3, 4.0}}}),
std::map<int, double>>);
static_assert(std::is_same_v<
decltype(std::map{{std::pair{1, 2.0}, {2, 3.0}, {3, 4.0}},
std::less<int>{}, {}}),
std::map<int, double>>);
static_assert(std::is_same_v<
decltype(std::map{{std::pair{1, 2.0}, {2, 3.0}, {3, 4.0}},
{}}),
std::map<int, double>>);
static_assert(std::is_same_v<
decltype(std::map{{std::pair{1, 2.0}, {2, 3.0}, {3, 4.0}},
{}, SimpleAllocator<std::pair<const int, double>>{}}),
std::map<int, double, std::less<int>,
SimpleAllocator<std::pair<const int, double>>>>);
void f()
{
std::map<int, double> x;
static_assert(std::is_same_v<
decltype(std::map(x.begin(), x.end())),
std::map<int, double>>);
static_assert(std::is_same_v<
decltype(std::map{x.begin(), x.end(),
std::less<int>{},
std::allocator<std::pair<const int, double>>{}}),
std::map<int, double>>);
static_assert(std::is_same_v<
decltype(std::map{x.begin(), x.end(),
std::less<int>{}, {}}),
std::map<int, double>>);
static_assert(std::is_same_v<
decltype(std::map(x.begin(), x.end(),
{})),
std::map<int, double>>);
static_assert(std::is_same_v<
decltype(std::map{x.begin(), x.end(),
{},
std::allocator<std::pair<const int, double>>{}}),
std::map<int, double>>);
static_assert(std::is_same_v<
decltype(std::map{x.begin(), x.end(),
{},
SimpleAllocator<std::pair<const int, double>>{}}),
std::map<int, double, std::less<int>,
SimpleAllocator<std::pair<const int, double>>>>);
}

View File

@ -0,0 +1,68 @@
// { dg-options "-std=gnu++17" }
// { dg-do compile { target c++17 } }
#include <map>
#include <testsuite_allocator.h>
using __gnu_test::SimpleAllocator;
static_assert(std::is_same_v<
decltype(std::multimap{std::pair{1, 2.0}, {2, 3.0}, {3, 4.0}}),
std::multimap<int, double>>);
static_assert(std::is_same_v<
decltype(std::multimap{{std::pair{1, 2.0}, {2, 3.0}, {3, 4.0}}}),
std::multimap<int, double>>);
static_assert(std::is_same_v<
decltype(std::multimap{{std::pair{1, 2.0}, {2, 3.0}, {3, 4.0}},
std::less<int>{}, {}}),
std::multimap<int, double>>);
static_assert(std::is_same_v<
decltype(std::multimap{{std::pair{1, 2.0}, {2, 3.0}, {3, 4.0}},
{}}),
std::multimap<int, double>>);
static_assert(std::is_same_v<
decltype(std::multimap{{std::pair{1, 2.0}, {2, 3.0}, {3, 4.0}},
{}, SimpleAllocator<std::pair<const int, double>>{}}),
std::multimap<int, double, std::less<int>,
SimpleAllocator<std::pair<const int, double>>>>);
void f()
{
std::multimap<int, double> x;
static_assert(std::is_same_v<
decltype(std::multimap(x.begin(), x.end())),
std::multimap<int, double>>);
static_assert(std::is_same_v<
decltype(std::multimap{x.begin(), x.end(),
std::less<int>{},
std::allocator<std::pair<const int, double>>{}}),
std::multimap<int, double>>);
static_assert(std::is_same_v<
decltype(std::multimap{x.begin(), x.end(),
std::less<int>{}, {}}),
std::multimap<int, double>>);
static_assert(std::is_same_v<
decltype(std::multimap(x.begin(), x.end(),
{})),
std::multimap<int, double>>);
static_assert(std::is_same_v<
decltype(std::multimap{x.begin(), x.end(),
{},
std::allocator<std::pair<const int, double>>{}}),
std::multimap<int, double>>);
static_assert(std::is_same_v<
decltype(std::multimap{x.begin(), x.end(),
{},
SimpleAllocator<std::pair<const int, double>>{}}),
std::multimap<int, double, std::less<int>,
SimpleAllocator<std::pair<const int, double>>>>);
}

View File

@ -0,0 +1,68 @@
// { dg-options "-std=gnu++17" }
// { dg-do compile { target c++17 } }
#include <set>
#include <testsuite_allocator.h>
using __gnu_test::SimpleAllocator;
static_assert(std::is_same_v<
decltype(std::multiset{1, 2, 3}),
std::multiset<int>>);
static_assert(std::is_same_v<
decltype(std::multiset{1, 2, 3}),
std::multiset<int>>);
static_assert(std::is_same_v<
decltype(std::multiset{{1, 2, 3},
std::less<int>{}, {}}),
std::multiset<int>>);
static_assert(std::is_same_v<
decltype(std::multiset{{1, 2, 3},
{}}),
std::multiset<int>>);
static_assert(std::is_same_v<
decltype(std::multiset{{1, 2, 3},
{}, SimpleAllocator<int>{}}),
std::multiset<int, std::less<int>,
SimpleAllocator<int>>>);
void f()
{
std::multiset<int> x;
static_assert(std::is_same_v<
decltype(std::multiset(x.begin(), x.end())),
std::multiset<int>>);
static_assert(std::is_same_v<
decltype(std::multiset{x.begin(), x.end(),
std::less<int>{},
std::allocator<int>{}}),
std::multiset<int>>);
static_assert(std::is_same_v<
decltype(std::multiset{x.begin(), x.end(),
std::less<int>{}, {}}),
std::multiset<int>>);
static_assert(std::is_same_v<
decltype(std::multiset(x.begin(), x.end(),
{})),
std::multiset<int>>);
static_assert(std::is_same_v<
decltype(std::multiset{x.begin(), x.end(),
{},
std::allocator<int>{}}),
std::multiset<int>>);
static_assert(std::is_same_v<
decltype(std::multiset{x.begin(), x.end(),
{},
SimpleAllocator<int>{}}),
std::multiset<int, std::less<int>, SimpleAllocator<int>>>);
}

View File

@ -0,0 +1,68 @@
// { dg-options "-std=gnu++17" }
// { dg-do compile { target c++17 } }
#include <set>
#include <testsuite_allocator.h>
using __gnu_test::SimpleAllocator;
static_assert(std::is_same_v<
decltype(std::set{1, 2, 3}),
std::set<int>>);
static_assert(std::is_same_v<
decltype(std::set{1, 2, 3}),
std::set<int>>);
static_assert(std::is_same_v<
decltype(std::set{{1, 2, 3},
std::less<int>{}, {}}),
std::set<int>>);
static_assert(std::is_same_v<
decltype(std::set{{1, 2, 3},
{}}),
std::set<int>>);
static_assert(std::is_same_v<
decltype(std::set{{1, 2, 3},
{}, SimpleAllocator<int>{}}),
std::set<int, std::less<int>,
SimpleAllocator<int>>>);
void f()
{
std::set<int> x;
static_assert(std::is_same_v<
decltype(std::set(x.begin(), x.end())),
std::set<int>>);
static_assert(std::is_same_v<
decltype(std::set{x.begin(), x.end(),
std::less<int>{},
std::allocator<int>{}}),
std::set<int>>);
static_assert(std::is_same_v<
decltype(std::set{x.begin(), x.end(),
std::less<int>{}, {}}),
std::set<int>>);
static_assert(std::is_same_v<
decltype(std::set(x.begin(), x.end(),
{})),
std::set<int>>);
static_assert(std::is_same_v<
decltype(std::set{x.begin(), x.end(),
{},
std::allocator<int>{}}),
std::set<int>>);
static_assert(std::is_same_v<
decltype(std::set{x.begin(), x.end(),
{},
SimpleAllocator<int>{}}),
std::set<int, std::less<int>, SimpleAllocator<int>>>);
}

View File

@ -0,0 +1,77 @@
// { dg-options "-std=gnu++17" }
// { dg-do compile { target c++17 } }
#include <unordered_map>
#include <testsuite_allocator.h>
using __gnu_test::SimpleAllocator;
static_assert(std::is_same_v<
decltype(std::unordered_map{std::pair{1, 2.0},
{2, 3.0}, {3, 4.0}}),
std::unordered_map<int, double>>);
static_assert(std::is_same_v<
decltype(std::unordered_map{{std::pair{1, 2.0},
{2, 3.0}, {3, 4.0}}}),
std::unordered_map<int, double>>);
static_assert(std::is_same_v<
decltype(std::unordered_map{{std::pair{1, 2.0},
{2, 3.0}, {3, 4.0}},
{}, std::hash<int>{}, {}}),
std::unordered_map<int, double>>);
static_assert(std::is_same_v<
decltype(std::unordered_map{{std::pair{1, 2.0},
{2, 3.0}, {3, 4.0}},
{}}),
std::unordered_map<int, double>>);
static_assert(std::is_same_v<
decltype(std::unordered_map{{std::pair{1, 2.0},
{2, 3.0}, {3, 4.0}},
{}, {}, {},
SimpleAllocator<std::pair<const int, double>>{}}),
std::unordered_map<int, double, std::hash<int>,
std::equal_to<int>,
SimpleAllocator<std::pair<const int, double>>>>);
void f()
{
std::unordered_map<int, double> x;
static_assert(std::is_same_v<
decltype(std::unordered_map(x.begin(), x.end())),
std::unordered_map<int, double>>);
static_assert(std::is_same_v<
decltype(std::unordered_map{x.begin(), x.end(),
{}, std::hash<int>{}, {},
std::allocator<std::pair<const int, double>>{}}),
std::unordered_map<int, double>>);
static_assert(std::is_same_v<
decltype(std::unordered_map{x.begin(), x.end(),
{}, std::hash<int>{}, {}}),
std::unordered_map<int, double>>);
static_assert(std::is_same_v<
decltype(std::unordered_map(x.begin(), x.end(),
{})),
std::unordered_map<int, double>>);
static_assert(std::is_same_v<
decltype(std::unordered_map{x.begin(), x.end(),
{}, {}, {},
std::allocator<std::pair<const int, double>>{}}),
std::unordered_map<int, double>>);
static_assert(std::is_same_v<
decltype(std::unordered_map{x.begin(), x.end(),
{}, {}, {},
SimpleAllocator<std::pair<const int, double>>{}}),
std::unordered_map<int, double, std::hash<int>,
std::equal_to<int>,
SimpleAllocator<std::pair<const int, double>>>>);
}

View File

@ -0,0 +1,77 @@
// { dg-options "-std=gnu++17" }
// { dg-do compile { target c++17 } }
#include <unordered_map>
#include <testsuite_allocator.h>
using __gnu_test::SimpleAllocator;
static_assert(std::is_same_v<
decltype(std::unordered_multimap{std::pair{1, 2.0},
{2, 3.0}, {3, 4.0}}),
std::unordered_multimap<int, double>>);
static_assert(std::is_same_v<
decltype(std::unordered_multimap{{std::pair{1, 2.0},
{2, 3.0}, {3, 4.0}}}),
std::unordered_multimap<int, double>>);
static_assert(std::is_same_v<
decltype(std::unordered_multimap{{std::pair{1, 2.0},
{2, 3.0}, {3, 4.0}},
{}, std::hash<int>{}, {}}),
std::unordered_multimap<int, double>>);
static_assert(std::is_same_v<
decltype(std::unordered_multimap{{std::pair{1, 2.0},
{2, 3.0}, {3, 4.0}},
{}}),
std::unordered_multimap<int, double>>);
static_assert(std::is_same_v<
decltype(std::unordered_multimap{{std::pair{1, 2.0},
{2, 3.0}, {3, 4.0}},
{}, {}, {},
SimpleAllocator<std::pair<const int, double>>{}}),
std::unordered_multimap<int, double, std::hash<int>,
std::equal_to<int>,
SimpleAllocator<std::pair<const int, double>>>>);
void f()
{
std::unordered_multimap<int, double> x;
static_assert(std::is_same_v<
decltype(std::unordered_multimap(x.begin(), x.end())),
std::unordered_multimap<int, double>>);
static_assert(std::is_same_v<
decltype(std::unordered_multimap{x.begin(), x.end(),
{}, std::hash<int>{}, {},
std::allocator<std::pair<const int, double>>{}}),
std::unordered_multimap<int, double>>);
static_assert(std::is_same_v<
decltype(std::unordered_multimap{x.begin(), x.end(),
{}, std::hash<int>{}, {}}),
std::unordered_multimap<int, double>>);
static_assert(std::is_same_v<
decltype(std::unordered_multimap(x.begin(), x.end(),
{})),
std::unordered_multimap<int, double>>);
static_assert(std::is_same_v<
decltype(std::unordered_multimap{x.begin(), x.end(),
{}, {}, {},
std::allocator<std::pair<const int, double>>{}}),
std::unordered_multimap<int, double>>);
static_assert(std::is_same_v<
decltype(std::unordered_multimap{x.begin(), x.end(),
{}, {}, {},
SimpleAllocator<std::pair<const int, double>>{}}),
std::unordered_multimap<int, double, std::hash<int>,
std::equal_to<int>,
SimpleAllocator<std::pair<const int, double>>>>);
}

View File

@ -0,0 +1,78 @@
// { dg-options "-std=gnu++17" }
// { dg-do compile { target c++17 } }
#include <unordered_set>
#include <testsuite_allocator.h>
using __gnu_test::SimpleAllocator;
static_assert(std::is_same_v<
decltype(std::unordered_multiset{1, 2, 3}),
std::unordered_multiset<int>>);
static_assert(std::is_same_v<
decltype(std::unordered_multiset{1, 2, 3}),
std::unordered_multiset<int>>);
static_assert(std::is_same_v<
decltype(std::unordered_multiset{{1, 2, 3},
0, std::hash<int>{}, {}}),
std::unordered_multiset<int>>);
static_assert(std::is_same_v<
decltype(std::unordered_multiset{{1, 2, 3},
{}}),
std::unordered_multiset<int>>);
static_assert(std::is_same_v<
decltype(std::unordered_multiset{{1, 2, 3},
{}, {}, {}, std::allocator<int>{}}),
std::unordered_multiset<int>>);
static_assert(std::is_same_v<
decltype(std::unordered_multiset{{1, 2, 3},
{}, {}, {}, SimpleAllocator<int>{}}),
std::unordered_multiset<int, std::hash<int>,
std::equal_to<int>,
SimpleAllocator<int>>>);
void f()
{
std::unordered_multiset<int> x;
static_assert(std::is_same_v<
decltype(std::unordered_multiset(x.begin(), x.end())),
std::unordered_multiset<int>>);
static_assert(std::is_same_v<
decltype(std::unordered_multiset{x.begin(), x.end(),
{},
std::hash<int>{},
std::equal_to<int>{},
std::allocator<int>{}}),
std::unordered_multiset<int>>);
static_assert(std::is_same_v<
decltype(std::unordered_multiset{x.begin(), x.end(),
{}, std::hash<int>{}, {}}),
std::unordered_multiset<int>>);
static_assert(std::is_same_v<
decltype(std::unordered_multiset(x.begin(), x.end(),
{})),
std::unordered_multiset<int>>);
static_assert(std::is_same_v<
decltype(std::unordered_multiset{x.begin(), x.end(),
{}, {}, {},
std::allocator<int>{}}),
std::unordered_multiset<int>>);
static_assert(std::is_same_v<
decltype(std::unordered_multiset{x.begin(), x.end(),
{}, {}, {},
SimpleAllocator<int>{}}),
std::unordered_multiset<int, std::hash<int>,
std::equal_to<int>,
SimpleAllocator<int>>>);
}

View File

@ -0,0 +1,78 @@
// { dg-options "-std=gnu++17" }
// { dg-do compile { target c++17 } }
#include <unordered_set>
#include <testsuite_allocator.h>
using __gnu_test::SimpleAllocator;
static_assert(std::is_same_v<
decltype(std::unordered_set{1, 2, 3}),
std::unordered_set<int>>);
static_assert(std::is_same_v<
decltype(std::unordered_set{1, 2, 3}),
std::unordered_set<int>>);
static_assert(std::is_same_v<
decltype(std::unordered_set{{1, 2, 3},
0, std::hash<int>{}, {}}),
std::unordered_set<int>>);
static_assert(std::is_same_v<
decltype(std::unordered_set{{1, 2, 3},
{}}),
std::unordered_set<int>>);
static_assert(std::is_same_v<
decltype(std::unordered_set{{1, 2, 3},
{}, {}, {}, std::allocator<int>{}}),
std::unordered_set<int>>);
static_assert(std::is_same_v<
decltype(std::unordered_set{{1, 2, 3},
{}, {}, {}, SimpleAllocator<int>{}}),
std::unordered_set<int, std::hash<int>,
std::equal_to<int>,
SimpleAllocator<int>>>);
void f()
{
std::unordered_set<int> x;
static_assert(std::is_same_v<
decltype(std::unordered_set(x.begin(), x.end())),
std::unordered_set<int>>);
static_assert(std::is_same_v<
decltype(std::unordered_set{x.begin(), x.end(),
{},
std::hash<int>{},
std::equal_to<int>{},
std::allocator<int>{}}),
std::unordered_set<int>>);
static_assert(std::is_same_v<
decltype(std::unordered_set{x.begin(), x.end(),
{}, std::hash<int>{}, {}}),
std::unordered_set<int>>);
static_assert(std::is_same_v<
decltype(std::unordered_set(x.begin(), x.end(),
{})),
std::unordered_set<int>>);
static_assert(std::is_same_v<
decltype(std::unordered_set{x.begin(), x.end(),
{}, {}, {},
std::allocator<int>{}}),
std::unordered_set<int>>);
static_assert(std::is_same_v<
decltype(std::unordered_set{x.begin(), x.end(),
{}, {}, {},
SimpleAllocator<int>{}}),
std::unordered_set<int, std::hash<int>,
std::equal_to<int>,
SimpleAllocator<int>>>);
}