* @param __list Input list to copy.
* @param __al An allocator object.
*/
- forward_list(const forward_list& __list, const _Alloc& __al)
+ forward_list(const forward_list& __list,
+ const __type_identity_t<_Alloc>& __al)
: _Base(_Node_alloc_type(__al))
{ _M_range_initialize(__list.begin(), __list.end()); }
* @param __list Input list to move.
* @param __al An allocator object.
*/
- forward_list(forward_list&& __list, const _Alloc& __al)
+ forward_list(forward_list&& __list,
+ const __type_identity_t<_Alloc>& __al)
noexcept(_Node_alloc_traits::_S_always_equal())
: forward_list(std::move(__list), _Node_alloc_type(__al),
typename _Node_alloc_traits::is_always_equal{})
}
public:
- vector(vector&& __x, const allocator_type& __a)
+ vector(vector&& __x, const __type_identity_t<allocator_type>& __a)
noexcept(_Bit_alloc_traits::_S_always_equal())
: vector(std::move(__x), __a,
typename _Bit_alloc_traits::is_always_equal{})
{ }
- vector(const vector& __x, const allocator_type& __a)
+ vector(const vector& __x, const __type_identity_t<allocator_type>& __a)
: _Base(__a)
{
_M_initialize(__x.size());
deque(deque&&) = default;
/// Copy constructor with alternative allocator
- deque(const deque& __x, const allocator_type& __a)
+ deque(const deque& __x, const __type_identity_t<allocator_type>& __a)
: _Base(__a, __x.size())
{ std::__uninitialized_copy_a(__x.begin(), __x.end(),
this->_M_impl._M_start,
_M_get_Tp_allocator()); }
/// Move constructor with alternative allocator
- deque(deque&& __x, const allocator_type& __a)
+ deque(deque&& __x, const __type_identity_t<allocator_type>& __a)
: deque(std::move(__x), __a, typename _Alloc_traits::is_always_equal{})
{ }
: _Base(_Node_alloc_type(__a))
{ _M_initialize_dispatch(__l.begin(), __l.end(), __false_type()); }
- list(const list& __x, const allocator_type& __a)
+ list(const list& __x, const __type_identity_t<allocator_type>& __a)
: _Base(_Node_alloc_type(__a))
{ _M_initialize_dispatch(__x.begin(), __x.end(), __false_type()); }
}
public:
- list(list&& __x, const allocator_type& __a)
+ list(list&& __x, const __type_identity_t<allocator_type>& __a)
noexcept(_Node_alloc_traits::_S_always_equal())
: list(std::move(__x), __a,
typename _Node_alloc_traits::is_always_equal{})
: _M_t(_Pair_alloc_type(__a)) { }
/// Allocator-extended copy constructor.
- map(const map& __m, const allocator_type& __a)
+ map(const map& __m, const __type_identity_t<allocator_type>& __a)
: _M_t(__m._M_t, _Pair_alloc_type(__a)) { }
/// Allocator-extended move constructor.
- map(map&& __m, const allocator_type& __a)
+ map(map&& __m, const __type_identity_t<allocator_type>& __a)
noexcept(is_nothrow_copy_constructible<_Compare>::value
&& _Alloc_traits::_S_always_equal())
: _M_t(std::move(__m._M_t), _Pair_alloc_type(__a)) { }
: _M_t(_Pair_alloc_type(__a)) { }
/// Allocator-extended copy constructor.
- multimap(const multimap& __m, const allocator_type& __a)
+ multimap(const multimap& __m,
+ const __type_identity_t<allocator_type>& __a)
: _M_t(__m._M_t, _Pair_alloc_type(__a)) { }
/// Allocator-extended move constructor.
- multimap(multimap&& __m, const allocator_type& __a)
+ multimap(multimap&& __m, const __type_identity_t<allocator_type>& __a)
noexcept(is_nothrow_copy_constructible<_Compare>::value
&& _Alloc_traits::_S_always_equal())
: _M_t(std::move(__m._M_t), _Pair_alloc_type(__a)) { }
: _M_t(_Key_alloc_type(__a)) { }
/// Allocator-extended copy constructor.
- multiset(const multiset& __m, const allocator_type& __a)
+ multiset(const multiset& __m,
+ const __type_identity_t<allocator_type>& __a)
: _M_t(__m._M_t, _Key_alloc_type(__a)) { }
/// Allocator-extended move constructor.
- multiset(multiset&& __m, const allocator_type& __a)
+ multiset(multiset&& __m, const __type_identity_t<allocator_type>& __a)
noexcept(is_nothrow_copy_constructible<_Compare>::value
&& _Alloc_traits::_S_always_equal())
: _M_t(std::move(__m._M_t), _Key_alloc_type(__a)) { }
queue(_Container) -> queue<typename _Container::value_type, _Container>;
template<typename _Container, typename _Allocator,
- typename = _RequireNotAllocator<_Container>,
- typename = _RequireAllocator<_Allocator>>
+ typename = _RequireNotAllocator<_Container>>
queue(_Container, _Allocator)
-> queue<typename _Container::value_type, _Container>;
template<typename _Compare, typename _Container, typename _Allocator,
typename = _RequireNotAllocator<_Compare>,
- typename = _RequireNotAllocator<_Container>,
- typename = _RequireAllocator<_Allocator>>
+ typename = _RequireNotAllocator<_Container>>
priority_queue(_Compare, _Container, _Allocator)
-> priority_queue<typename _Container::value_type, _Container, _Compare>;
#endif
: _M_t(_Key_alloc_type(__a)) { }
/// Allocator-extended copy constructor.
- set(const set& __x, const allocator_type& __a)
+ set(const set& __x, const __type_identity_t<allocator_type>& __a)
: _M_t(__x._M_t, _Key_alloc_type(__a)) { }
/// Allocator-extended move constructor.
- set(set&& __x, const allocator_type& __a)
+ set(set&& __x, const __type_identity_t<allocator_type>& __a)
noexcept(is_nothrow_copy_constructible<_Compare>::value
&& _Alloc_traits::_S_always_equal())
: _M_t(std::move(__x._M_t), _Key_alloc_type(__a)) { }
stack(_Container) -> stack<typename _Container::value_type, _Container>;
template<typename _Container, typename _Allocator,
- typename = _RequireNotAllocator<_Container>,
- typename = _RequireAllocator<_Allocator>>
+ typename = _RequireNotAllocator<_Container>>
stack(_Container, _Allocator)
-> stack<typename _Container::value_type, _Container>;
vector(vector&&) noexcept = default;
/// Copy constructor with alternative allocator
- vector(const vector& __x, const allocator_type& __a)
+ vector(const vector& __x, const __type_identity_t<allocator_type>& __a)
: _Base(__x.size(), __a)
{
this->_M_impl._M_finish =
public:
/// Move constructor with alternative allocator
- vector(vector&& __rv, const allocator_type& __m)
+ vector(vector&& __rv, const __type_identity_t<allocator_type>& __m)
noexcept( noexcept(
vector(std::declval<vector&&>(), std::declval<const allocator_type&>(),
std::declval<typename _Alloc_traits::is_always_equal>())) )
deque(const deque&) = default;
deque(deque&&) = default;
- deque(const deque& __d, const _Allocator& __a)
+ deque(const deque& __d, const __type_identity_t<_Allocator>& __a)
: _Base(__d, __a) { }
- deque(deque&& __d, const _Allocator& __a)
+ deque(deque&& __d, const __type_identity_t<_Allocator>& __a)
: _Safe(std::move(__d)), _Base(std::move(__d), __a) { }
deque(initializer_list<value_type> __l,
~list() = default;
- list(const list& __x, const allocator_type& __a)
+ list(const list& __x, const __type_identity_t<allocator_type>& __a)
: _Base(__x, __a) { }
- list(list&& __x, const allocator_type& __a)
+ list(list&& __x, const __type_identity_t<allocator_type>& __a)
noexcept(
std::is_nothrow_constructible<_Base,
_Base, const allocator_type&>::value )
map(const allocator_type& __a)
: _Base(__a) { }
- map(const map& __m, const allocator_type& __a)
+ map(const map& __m, const __type_identity_t<allocator_type>& __a)
: _Base(__m, __a) { }
- map(map&& __m, const allocator_type& __a)
+ map(map&& __m, const __type_identity_t<allocator_type>& __a)
noexcept( noexcept(_Base(std::move(__m._M_base()), __a)) )
: _Safe(std::move(__m._M_safe()), __a),
_Base(std::move(__m._M_base()), __a) { }
multimap(const allocator_type& __a)
: _Base(__a) { }
- multimap(const multimap& __m, const allocator_type& __a)
+ multimap(const multimap& __m,
+ const __type_identity_t<allocator_type>& __a)
: _Base(__m, __a) { }
- multimap(multimap&& __m, const allocator_type& __a)
+ multimap(multimap&& __m, const __type_identity_t<allocator_type>& __a)
noexcept( noexcept(_Base(std::move(__m._M_base()), __a)) )
: _Safe(std::move(__m._M_safe()), __a),
_Base(std::move(__m._M_base()), __a) { }
multiset(const allocator_type& __a)
: _Base(__a) { }
- multiset(const multiset& __m, const allocator_type& __a)
+ multiset(const multiset& __m,
+ const __type_identity_t<allocator_type>& __a)
: _Base(__m, __a) { }
- multiset(multiset&& __m, const allocator_type& __a)
+ multiset(multiset&& __m, const __type_identity_t<allocator_type>& __a)
noexcept( noexcept(_Base(std::move(__m._M_base()), __a)) )
: _Safe(std::move(__m._M_safe()), __a),
_Base(std::move(__m._M_base()), __a) { }
set(const allocator_type& __a)
: _Base(__a) { }
- set(const set& __x, const allocator_type& __a)
+ set(const set& __x, const __type_identity_t<allocator_type>& __a)
: _Base(__x, __a) { }
- set(set&& __x, const allocator_type& __a)
+ set(set&& __x, const __type_identity_t<allocator_type>& __a)
noexcept( noexcept(_Base(std::move(__x._M_base()), __a)) )
: _Safe(std::move(__x._M_safe()), __a),
_Base(std::move(__x._M_base()), __a) { }
vector(const vector&) = default;
vector(vector&&) = default;
- vector(const vector& __x, const allocator_type& __a)
+ vector(const vector& __x, const __type_identity_t<allocator_type>& __a)
: _Base(__x, __a) { }
- vector(vector&& __x, const allocator_type& __a)
+ vector(vector&& __x, const __type_identity_t<allocator_type>& __a)
noexcept(
std::is_nothrow_constructible<_Base,
_Base, const allocator_type&>::value )
#include <deque>
#include <testsuite_iterators.h>
+#include <testsuite_allocator.h>
template<typename T>
using input_iterator_seq
std::deque s4(1U, 2L, std::allocator<long>());
check_type<std::deque<long>>(s4);
}
+
+struct Pool;
+
+template<typename T>
+struct Alloc : __gnu_test::SimpleAllocator<T>
+{
+ Alloc(Pool*) { }
+
+ template<typename U>
+ Alloc(const Alloc<U>&) { }
+};
+
+void
+test_p1518r2()
+{
+ // P1518R2 - Stop overconstraining allocators in container deduction guides.
+ // This is a C++23 feature but we support it for C++17 too.
+
+ using Deque = std::deque<unsigned, Alloc<unsigned>>;
+ Pool* p = nullptr;
+ Deque d(p);
+
+ std::deque s1(d, p);
+ check_type<Deque>(s1);
+
+ std::deque s2(std::move(d), p);
+ check_type<Deque>(s2);
+}
#include <forward_list>
#include <testsuite_iterators.h>
+#include <testsuite_allocator.h>
template<typename T>
using input_iterator_seq
std::forward_list s4(1U, 2L, std::allocator<long>());
check_type<std::forward_list<long>>(s4);
}
+
+struct Pool;
+
+template<typename T>
+struct Alloc : __gnu_test::SimpleAllocator<T>
+{
+ Alloc(Pool*) { }
+
+ template<typename U>
+ Alloc(const Alloc<U>&) { }
+};
+
+void
+test_p1518r2()
+{
+ // P1518R2 - Stop overconstraining allocators in container deduction guides.
+ // This is a C++23 feature but we support it for C++17 too.
+
+ using Flist = std::forward_list<unsigned, Alloc<unsigned>>;
+ Pool* p = nullptr;
+ Flist f(p);
+
+ std::forward_list s1(f, p);
+ check_type<Flist>(s1);
+
+ std::forward_list s2(std::move(f), p);
+ check_type<Flist>(s2);
+}
#include <list>
#include <testsuite_iterators.h>
+#include <testsuite_allocator.h>
template<typename T>
using input_iterator_seq
std::list s4(1U, 2L, std::allocator<long>());
check_type<std::list<long>>(s4);
}
+
+struct Pool;
+
+template<typename T>
+struct Alloc : __gnu_test::SimpleAllocator<T>
+{
+ Alloc(Pool*) { }
+
+ template<typename U>
+ Alloc(const Alloc<U>&) { }
+};
+
+void
+test_p1518r2()
+{
+ // P1518R2 - Stop overconstraining allocators in container deduction guides.
+ // This is a C++23 feature but we support it for C++17 too.
+
+ using List = std::list<unsigned, Alloc<unsigned>>;
+ Pool* p = nullptr;
+ List l(p);
+
+ std::list s1(l, p);
+ check_type<List>(s1);
+
+ std::list s2(std::move(l), p);
+ check_type<List>(s2);
+}
std::map<int, double, std::less<int>,
SimpleAllocator<value_type>>>);
}
+
+template<typename T, typename U> struct require_same;
+template<typename T> struct require_same<T, T> { using type = void; };
+
+template<typename T, typename U>
+ typename require_same<T, U>::type
+ check_type(U&) { }
+
+struct Pool;
+
+template<typename T>
+struct Alloc : __gnu_test::SimpleAllocator<T>
+{
+ Alloc(Pool*) { }
+
+ template<typename U>
+ Alloc(const Alloc<U>&) { }
+};
+
+void
+test_p1518r2()
+{
+ // P1518R2 - Stop overconstraining allocators in container deduction guides.
+ // This is a C++23 feature but we support it for C++17 too.
+
+ using PairAlloc = Alloc<std::pair<const unsigned, void*>>;
+ using Map = std::map<unsigned, void*, std::greater<>, PairAlloc>;
+ Pool* p = nullptr;
+ Map m(p);
+
+ std::map s1(m, p);
+ check_type<Map>(s1);
+
+ std::map s2(std::move(m), p);
+ check_type<Map>(s2);
+}
std::multimap<int, double, std::less<int>,
SimpleAllocator<value_type>>>);
}
+
+template<typename T, typename U> struct require_same;
+template<typename T> struct require_same<T, T> { using type = void; };
+
+template<typename T, typename U>
+ typename require_same<T, U>::type
+ check_type(U&) { }
+
+struct Pool;
+
+template<typename T>
+struct Alloc : __gnu_test::SimpleAllocator<T>
+{
+ Alloc(Pool*) { }
+
+ template<typename U>
+ Alloc(const Alloc<U>&) { }
+};
+
+void
+test_p1518r2()
+{
+ // P1518R2 - Stop overconstraining allocators in container deduction guides.
+ // This is a C++23 feature but we support it for C++17 too.
+
+ using PairAlloc = Alloc<std::pair<const unsigned, void*>>;
+ using MMap = std::multimap<unsigned, void*, std::greater<>, PairAlloc>;
+ Pool* p = nullptr;
+ MMap m(p);
+
+ std::multimap s1(m, p);
+ check_type<MMap>(s1);
+
+ std::multimap s2(std::move(m), p);
+ check_type<MMap>(s2);
+}
std::multiset<int, std::less<int>,
SimpleAllocator<value_type>>>);
}
+
+template<typename T, typename U> struct require_same;
+template<typename T> struct require_same<T, T> { using type = void; };
+
+template<typename T, typename U>
+ typename require_same<T, U>::type
+ check_type(U&) { }
+
+struct Pool;
+
+template<typename T>
+struct Alloc : __gnu_test::SimpleAllocator<T>
+{
+ Alloc(Pool*) { }
+
+ template<typename U>
+ Alloc(const Alloc<U>&) { }
+};
+
+void
+test_p1518r2()
+{
+ // P1518R2 - Stop overconstraining allocators in container deduction guides.
+ // This is a C++23 feature but we support it for C++17 too.
+
+ using MSet = std::multiset<unsigned, std::greater<>, Alloc<unsigned>>;
+ Pool* p = nullptr;
+ MSet s(p);
+
+ std::multiset s1(s, p);
+ check_type<MSet>(s1);
+
+ std::multiset s2(std::move(s), p);
+ check_type<MSet>(s2);
+}
#include <deque>
#include <vector>
#include <testsuite_iterators.h>
+#include <testsuite_allocator.h>
template<typename T, typename U> struct require_same;
template<typename T> struct require_same<T, T> { using type = void; };
std::priority_queue s14(seq.begin(), seq.end(), cmp, std::deque<short>{});
check_type<std::priority_queue<short, std::deque<short>, Cmp>>(s14);
}
+
+struct Pool;
+
+template<typename T>
+struct Alloc : __gnu_test::SimpleAllocator<T>
+{
+ Alloc(Pool*) { }
+
+ template<typename U>
+ Alloc(const Alloc<U>&) { }
+};
+
+void
+test_p1518r2()
+{
+ // P1518R2 - Stop overconstraining allocators in container deduction guides.
+ // This is a C++23 feature but we support it for C++17 too.
+
+ using Vector = std::vector<short, Alloc<short>>;
+ using Cmp = std::greater<long>;
+ Pool* p = nullptr;
+ Vector v(p);
+ Cmp cmp;
+
+ std::priority_queue q1(cmp, v, p);
+ check_type<std::priority_queue<short, Vector, Cmp>>(q1);
+
+ std::priority_queue q2(cmp, std::move(v), p);
+ check_type<std::priority_queue<short, Vector, Cmp>>(q2);
+
+ std::priority_queue q3(q1, p);
+ check_type<std::priority_queue<short, Vector, Cmp>>(q3);
+
+ std::priority_queue q4(std::move(q1), p);
+ check_type<std::priority_queue<short, Vector, Cmp>>(q4);
+}
#include <queue>
#include <deque>
#include <list>
+#include <testsuite_allocator.h>
template<typename T, typename U> struct require_same;
template<typename T> struct require_same<T, T> { using type = void; };
std::queue s8(std::move(l), l.get_allocator());
check_type<std::queue<long, std::list<long>>>(s8);
}
+
+struct Pool;
+
+template<typename T>
+struct Alloc : __gnu_test::SimpleAllocator<T>
+{
+ Alloc(Pool*) { }
+
+ template<typename U>
+ Alloc(const Alloc<U>&) { }
+};
+
+void
+test_p1518r2()
+{
+ // P1518R2 - Stop overconstraining allocators in container deduction guides.
+ // This is a C++23 feature but we support it for C++17 too.
+
+ using Deque = std::deque<unsigned, Alloc<unsigned>>;
+ using List = std::list<long, Alloc<long>>;
+ Pool* p = nullptr;
+ Deque d(p);
+ List l(p);
+
+ std::queue q1(d, p);
+ check_type<std::queue<unsigned, Deque>>(q1);
+
+ std::queue q2(l, p);
+ check_type<std::queue<long, List>>(q2);
+
+ std::queue q3(q2, p);
+ check_type<std::queue<long, List>>(q3);
+}
std::set<int, std::less<int>,
SimpleAllocator<value_type>>>);
}
+
+template<typename T, typename U> struct require_same;
+template<typename T> struct require_same<T, T> { using type = void; };
+
+template<typename T, typename U>
+ typename require_same<T, U>::type
+ check_type(U&) { }
+
+struct Pool;
+
+template<typename T>
+struct Alloc : __gnu_test::SimpleAllocator<T>
+{
+ Alloc(Pool*) { }
+
+ template<typename U>
+ Alloc(const Alloc<U>&) { }
+};
+
+void
+test_p1518r2()
+{
+ // P1518R2 - Stop overconstraining allocators in container deduction guides.
+ // This is a C++23 feature but we support it for C++17 too.
+
+ using Set = std::set<unsigned, std::greater<>, Alloc<unsigned>>;
+ Pool* p = nullptr;
+ Set s(p);
+
+ std::set s1(s, p);
+ check_type<Set>(s1);
+
+ std::set s2(std::move(s), p);
+ check_type<Set>(s2);
+}
#include <stack>
#include <deque>
#include <list>
+#include <testsuite_allocator.h>
template<typename T, typename U> struct require_same;
template<typename T> struct require_same<T, T> { using type = void; };
void
test02()
- {
+{
std::deque<unsigned> d;
std::list<long> l;
std::equal_to<int>,
SimpleAllocator<std::pair<const int, double>>>>);
}
+
+template<typename T, typename U> struct require_same;
+template<typename T> struct require_same<T, T> { using type = void; };
+
+template<typename T, typename U>
+ typename require_same<T, U>::type
+ check_type(U&) { }
+
+struct Pool;
+
+template<typename T>
+struct Alloc : __gnu_test::SimpleAllocator<T>
+{
+ Alloc(Pool*) { }
+
+ template<typename U>
+ Alloc(const Alloc<U>&) { }
+};
+
+void
+test_p1518r2()
+{
+ // P1518R2 - Stop overconstraining allocators in container deduction guides.
+ // This is a C++23 feature but we support it for C++17 too.
+
+ using PairAlloc = Alloc<std::pair<const unsigned, void*>>;
+ using Hash = std::hash<unsigned long>;
+ using Eq = std::equal_to<>;
+ using UMap = std::unordered_map<unsigned, void*, Hash, Eq, PairAlloc>;
+ Pool* p = nullptr;
+ UMap m(p);
+
+ std::unordered_map s1(m, p);
+ check_type<UMap>(s1);
+
+ std::unordered_map s2(std::move(m), p);
+ check_type<UMap>(s2);
+}
std::equal_to<int>,
SimpleAllocator<std::pair<const int, double>>>>);
}
+
+template<typename T, typename U> struct require_same;
+template<typename T> struct require_same<T, T> { using type = void; };
+
+template<typename T, typename U>
+ typename require_same<T, U>::type
+ check_type(U&) { }
+
+struct Pool;
+
+template<typename T>
+struct Alloc : __gnu_test::SimpleAllocator<T>
+{
+ Alloc(Pool*) { }
+
+ template<typename U>
+ Alloc(const Alloc<U>&) { }
+};
+
+void
+test_p1518r2()
+{
+ // P1518R2 - Stop overconstraining allocators in container deduction guides.
+ // This is a C++23 feature but we support it for C++17 too.
+
+ using PairAlloc = Alloc<std::pair<const unsigned, void*>>;
+ using Hash = std::hash<unsigned long>;
+ using Eq = std::equal_to<>;
+ using UMMap = std::unordered_multimap<unsigned, void*, Hash, Eq, PairAlloc>;
+ Pool* p = nullptr;
+ UMMap m(p);
+
+ std::unordered_multimap s1(m, p);
+ check_type<UMMap>(s1);
+
+ std::unordered_multimap s2(std::move(m), p);
+ check_type<UMMap>(s2);
+}
std::equal_to<int>,
SimpleAllocator<int>>>);
}
+
+template<typename T, typename U> struct require_same;
+template<typename T> struct require_same<T, T> { using type = void; };
+
+template<typename T, typename U>
+ typename require_same<T, U>::type
+ check_type(U&) { }
+
+struct Pool;
+
+template<typename T>
+struct Alloc : __gnu_test::SimpleAllocator<T>
+{
+ Alloc(Pool*) { }
+
+ template<typename U>
+ Alloc(const Alloc<U>&) { }
+};
+
+void
+test_p1518r2()
+{
+ // P1518R2 - Stop overconstraining allocators in container deduction guides.
+ // This is a C++23 feature but we support it for C++17 too.
+
+ using Hash = std::hash<unsigned long>;
+ using Eq = std::equal_to<>;
+ using UMSet = std::unordered_multiset<unsigned, Hash, Eq, Alloc<unsigned>>;
+ Pool* p = nullptr;
+ UMSet s(p);
+
+ std::unordered_multiset s1(s, p);
+ check_type<UMSet>(s1);
+
+ std::unordered_multiset s2(std::move(s), p);
+ check_type<UMSet>(s2);
+}
std::equal_to<int>,
SimpleAllocator<int>>>);
}
+
+template<typename T, typename U> struct require_same;
+template<typename T> struct require_same<T, T> { using type = void; };
+
+template<typename T, typename U>
+ typename require_same<T, U>::type
+ check_type(U&) { }
+
+struct Pool;
+
+template<typename T>
+struct Alloc : __gnu_test::SimpleAllocator<T>
+{
+ Alloc(Pool*) { }
+
+ template<typename U>
+ Alloc(const Alloc<U>&) { }
+};
+
+void
+test_p1518r2()
+{
+ // P1518R2 - Stop overconstraining allocators in container deduction guides.
+ // This is a C++23 feature but we support it for C++17 too.
+
+ using Hash = std::hash<unsigned long>;
+ using Eq = std::equal_to<>;
+ using USet = std::unordered_set<unsigned, Hash, Eq, Alloc<unsigned>>;
+ Pool* p = nullptr;
+ USet s(p);
+
+ std::unordered_set s1(s, p);
+ check_type<USet>(s1);
+
+ std::unordered_set s2(std::move(s), p);
+ check_type<USet>(s2);
+}
#include <vector>
#include <testsuite_iterators.h>
+#include <testsuite_allocator.h>
template<typename T>
using input_iterator_seq
check_type<const std::vector<unsigned>>(s4);
}
+void
+test01b()
+{
+ std::vector<bool> s0;
+
+ std::vector s1 = s0;
+ check_type<std::vector<bool>>(s1);
+
+ std::vector s2 = std::move(s0);
+ check_type<std::vector<bool>>(s2);
+
+ const std::vector s3 = s0;
+ check_type<const std::vector<bool>>(s3);
+
+ const std::vector s4 = s3;
+ check_type<const std::vector<bool>>(s4);
+}
+
void
test02()
{
std::vector s4(1U, 2L, std::allocator<long>());
check_type<std::vector<long>>(s4);
}
+
+void
+test02b()
+{
+ bool a[1] = {};
+ input_iterator_seq<bool> seq(a);
+
+ std::vector s1(seq.begin(), seq.end());
+ check_type<std::vector<bool>>(s1);
+
+ std::vector s2(seq.begin(), seq.end(), std::allocator<bool>());
+ check_type<std::vector<bool>>(s2);
+
+ std::vector s3(1U, true);
+ check_type<std::vector<bool>>(s3);
+
+ std::vector s4(1U, true, std::allocator<bool>());
+ check_type<std::vector<bool>>(s4);
+}
+
+struct Pool;
+
+template<typename T>
+struct Alloc : __gnu_test::SimpleAllocator<T>
+{
+ Alloc(Pool*) { }
+
+ template<typename U>
+ Alloc(const Alloc<U>&) { }
+};
+
+void
+test_p1518r2()
+{
+ // P1518R2 - Stop overconstraining allocators in container deduction guides.
+ // This is a C++23 feature but we support it for C++17 too.
+
+ using Vector = std::vector<unsigned, Alloc<unsigned>>;
+ Pool* p = nullptr;
+ Vector v(p);
+
+ std::vector s1(v, p);
+ check_type<Vector>(s1);
+
+ std::vector s2(std::move(v), p);
+ check_type<Vector>(s2);
+
+ using BVector = std::vector<bool, Alloc<bool>>;
+ BVector b(p);
+
+ std::vector s3(b, p);
+ check_type<BVector>(s3);
+
+ std::vector s4(std::move(b), p);
+ check_type<BVector>(s4);
+}