test01()
{
using value_type = std::pair<std::pair<X, int>, std::pair<int, X>>;
- using scoped_alloc
- = std::scoped_allocator_adaptor<__gnu_test::uneq_allocator<value_type>>;
+ using uneq_alloc = __gnu_test::uneq_allocator<value_type>;
+ using scoped_alloc = std::scoped_allocator_adaptor<uneq_alloc>;
- const scoped_alloc a(10);
+ const scoped_alloc a(uneq_alloc(10));
std::vector<value_type, scoped_alloc> v(a);
VERIFY( v.get_allocator().get_personality() == a.get_personality() );
test02()
{
using value_type = std::pair<std::pair<X, int>, std::pair<int, X>>;
+ using uneq_alloc = __gnu_test::uneq_allocator<value_type>;
using scoped_alloc
- = std::scoped_allocator_adaptor<__gnu_test::uneq_allocator<value_type>,
- X::allocator_type>;
+ = std::scoped_allocator_adaptor<uneq_alloc, X::allocator_type>;
- const scoped_alloc a(10, 20);
+ const scoped_alloc a(uneq_alloc(10), X::allocator_type(20));
std::vector<value_type, scoped_alloc> v(a);
VERIFY( v.get_allocator().get_personality() == a.get_personality() );
using __gnu_test::uneq_allocator;
using UneqAlloc = uneq_allocator<int>;
-using ScopedAlloc = std::scoped_allocator_adaptor<
- uneq_allocator<std::vector<int, UneqAlloc>>,
- UneqAlloc>;
+using UneqVecAlloc = uneq_allocator<std::vector<int, UneqAlloc>>;
+using ScopedAlloc
+ = std::scoped_allocator_adaptor<UneqVecAlloc, UneqAlloc>;
struct Obj
{
if (std::is_constant_evaluated())
return;
+ const ScopedAlloc scopedAlloc(UneqVecAlloc(11), UneqAlloc(22));
// Object is constructed using allocator-aware constructor.
std::indirect<std::vector<int, UneqAlloc>, ScopedAlloc>
- i3(std::allocator_arg, ScopedAlloc(11, 22));
+ i3(std::allocator_arg, scopedAlloc);
VERIFY( i3->empty() );
VERIFY( i3->get_allocator().get_personality() == 22 );
VERIFY( i3.get_allocator().get_personality() == 11 );
if (std::is_constant_evaluated())
return;
+ const ScopedAlloc scopedAlloc(UneqVecAlloc(11), UneqAlloc(22));
std::vector<int, UneqAlloc> v{1, 2, 3, 4, 5};
// Object is constructed using allocator-aware constructor.
std::indirect<std::vector<int, UneqAlloc>, ScopedAlloc>
- i7(std::allocator_arg, ScopedAlloc(11, 22), v);
+ i7(std::allocator_arg, scopedAlloc, v);
VERIFY( i7->size() == 5 );
VERIFY( v.size() == 5 );
VERIFY( i7->get_allocator().get_personality() == 22 );
VERIFY( i7.get_allocator().get_personality() == 11 );
std::indirect<std::vector<int, UneqAlloc>, ScopedAlloc>
- i8(std::allocator_arg, ScopedAlloc(11, 22), std::move(v));
+ i8(std::allocator_arg, scopedAlloc, std::move(v));
VERIFY( i8->size() == 5 );
VERIFY( v.size() == 0 );
VERIFY( i8->get_allocator().get_personality() == 22 );
VERIFY( i2->c[1] == 0 );
std::indirect<Obj, uneq_allocator<Obj>>
- i3(std::allocator_arg, 42, std::in_place);
+ i3(std::allocator_arg, uneq_allocator<Obj>(42),
+ std::in_place);
VERIFY( i3->i == 0 );
VERIFY( i3->c[0] == 0 );
VERIFY( i3->c[1] == 0 );
VERIFY( i3.get_allocator().get_personality() == 42 );
- std::indirect<Obj, uneq_allocator<Obj>>
- i4(std::allocator_arg, 42, std::in_place, 10);
+ std::indirect<Obj, uneq_allocator<Obj>>
+ i4(std::allocator_arg, uneq_allocator<Obj>(42),
+ std::in_place, 10);
VERIFY( i4->i == 10 );
VERIFY( i4->c[0] == 0 );
VERIFY( i4->c[1] == 0 );
if (std::is_constant_evaluated())
return;
+ const ScopedAlloc scopedAlloc(UneqVecAlloc(11), UneqAlloc(22));
std::indirect<std::vector<int, UneqAlloc>, ScopedAlloc>
- i14(std::allocator_arg, ScopedAlloc(11, 22),
+ i14(std::allocator_arg, scopedAlloc,
std::in_place);
VERIFY( i14->size() == 0 );
VERIFY( i14->get_allocator().get_personality() == 22 );
VERIFY( i14.get_allocator().get_personality() == 11 );
std::indirect<std::vector<int, UneqAlloc>, ScopedAlloc>
- i15(std::allocator_arg, ScopedAlloc(11, 22),
+ i15(std::allocator_arg, scopedAlloc,
std::in_place, 5, 13);
VERIFY( i15->size() == 5 );
VERIFY( i15->at(0) == 13 );
VERIFY( i15.get_allocator().get_personality() == 11 );
std::indirect<std::vector<int, UneqAlloc>, ScopedAlloc>
- i16(std::allocator_arg, ScopedAlloc(11, 22),
+ i16(std::allocator_arg, scopedAlloc,
std::in_place, {1, 2, 3, 4});
VERIFY( i16->size() == 4 );
VERIFY( i16->at(2) == 3 );
using __gnu_test::uneq_allocator;
using UneqAlloc = uneq_allocator<int>;
-using ScopedAlloc = std::scoped_allocator_adaptor<
- uneq_allocator<std::vector<int, UneqAlloc>>,
- UneqAlloc>;
+using UneqVecAlloc = uneq_allocator<std::vector<int, UneqAlloc>>;
+using ScopedAlloc
+ = std::scoped_allocator_adaptor<UneqVecAlloc, UneqAlloc>;
struct Obj
{
if (std::is_constant_evaluated())
return;
+ const ScopedAlloc scopedAlloc(UneqVecAlloc(11), UneqAlloc(22));
// Object is constructed using allocator-aware constructor.
std::polymorphic<std::vector<int, UneqAlloc>, ScopedAlloc>
- i3(std::allocator_arg, ScopedAlloc(11, 22));
+ i3(std::allocator_arg, scopedAlloc);
VERIFY( i3->empty() );
VERIFY( i3->get_allocator().get_personality() == 22 );
VERIFY( i3.get_allocator().get_personality() == 11 );
if (std::is_constant_evaluated())
return;
+ const ScopedAlloc scopedAlloc(UneqVecAlloc(11), UneqAlloc(22));
std::vector<int, UneqAlloc> v{1, 2, 3, 4, 5};
// Object is constructed using allocator-aware constructor.
std::polymorphic<std::vector<int, UneqAlloc>, ScopedAlloc>
- i7(std::allocator_arg, ScopedAlloc(11, 22), v);
+ i7(std::allocator_arg, scopedAlloc, v);
VERIFY( i7->size() == 5 );
VERIFY( v.size() == 5 );
VERIFY( i7->get_allocator().get_personality() == 22 );
VERIFY( i7.get_allocator().get_personality() == 11 );
std::polymorphic<std::vector<int, UneqAlloc>, ScopedAlloc>
- i8(std::allocator_arg, ScopedAlloc(11, 22), std::move(v));
+ i8(std::allocator_arg, scopedAlloc, std::move(v));
VERIFY( i8->size() == 5 );
VERIFY( v.size() == 0 );
VERIFY( i8->get_allocator().get_personality() == 22 );
VERIFY( i2->c[1] == 0 );
std::polymorphic<Obj, uneq_allocator<Obj>>
- i3(std::allocator_arg, 42, std::in_place_type<Obj>);
+ i3(std::allocator_arg, uneq_allocator<Obj>(42),
+ std::in_place_type<Obj>);
VERIFY( i3->i == 0 );
VERIFY( i3->c[0] == 0 );
VERIFY( i3->c[1] == 0 );
VERIFY( i3.get_allocator().get_personality() == 42 );
std::polymorphic<Obj, uneq_allocator<Obj>>
- i4(std::allocator_arg, 42, std::in_place_type<Obj>, 10);
+ i4(std::allocator_arg, uneq_allocator<Obj>(42),
+ std::in_place_type<Obj>, 10);
VERIFY( i4->i == 10 );
VERIFY( i4->c[0] == 0 );
VERIFY( i4->c[1] == 0 );
if (std::is_constant_evaluated())
return;
+ const ScopedAlloc scopedAlloc(UneqVecAlloc(11), UneqAlloc(22));
std::polymorphic<std::vector<int, UneqAlloc>, ScopedAlloc>
- i14(std::allocator_arg, ScopedAlloc(11, 22),
+ i14(std::allocator_arg, scopedAlloc,
std::in_place_type<std::vector<int, UneqAlloc>>);
VERIFY( i14->size() == 0 );
VERIFY( i14->get_allocator().get_personality() == 22 );
VERIFY( i14.get_allocator().get_personality() == 11 );
std::polymorphic<std::vector<int, UneqAlloc>, ScopedAlloc>
- i15(std::allocator_arg, ScopedAlloc(11, 22),
+ i15(std::allocator_arg, scopedAlloc,
std::in_place_type<std::vector<int, UneqAlloc>>, 5, 13);
VERIFY( i15->size() == 5 );
VERIFY( i15->at(0) == 13 );
VERIFY( i15.get_allocator().get_personality() == 11 );
std::polymorphic<std::vector<int, UneqAlloc>, ScopedAlloc>
- i16(std::allocator_arg, ScopedAlloc(11, 22),
+ i16(std::allocator_arg, scopedAlloc,
std::in_place_type<std::vector<int, UneqAlloc>>, {1, 2, 3, 4});
VERIFY( i16->size() == 4 );
VERIFY( i16->at(2) == 3 );
if (std::is_constant_evaluated())
return;
+ const ScopedAlloc scopedAlloc(uneq_allocator<Base>(11), UneqAlloc(22));
const VecDerived<int, UneqAlloc> v{1, 2, 3, 4, 5};
// Object is constructed using allocator-aware constructor.
std::polymorphic<Base, ScopedAlloc>
- i5(std::allocator_arg, ScopedAlloc(11, 22), v);
+ i5(std::allocator_arg, scopedAlloc, v);
VERIFY( *i5 == v );
VERIFY( i5->get_personality() == 22 );
VERIFY( i5.get_allocator().get_personality() == 11 );
std::polymorphic<Base, ScopedAlloc>
- i6(std::allocator_arg, ScopedAlloc(11, 22), auto(v));
+ i6(std::allocator_arg, scopedAlloc, auto(v));
VERIFY( *i6 == v );
VERIFY( i6->get_personality() == 22 );
VERIFY( i6.get_allocator().get_personality() == 11 );
VERIFY( i2->get_personality() == -2 );
std::polymorphic<Base, uneq_allocator<Base>>
- i3(std::allocator_arg, 42, std::in_place_type<ObjDerived>);
+ i3(std::allocator_arg, uneq_allocator<Base>(42),
+ std::in_place_type<ObjDerived>);
VERIFY( *i3 == ObjDerived() );
VERIFY( i3->get_personality() == -2 );
VERIFY( i3.get_allocator().get_personality() == 42 );
std::polymorphic<Base, uneq_allocator<Base>>
- i4(std::allocator_arg, 42, std::in_place_type<ObjDerived>, 10, 20, 30);
+ i4(std::allocator_arg, uneq_allocator<Base>(42),
+ std::in_place_type<ObjDerived>, 10, 20, 30);
VERIFY( *i4 == ObjDerived(10, 20, 30) );
VERIFY( i4->get_personality() == -2 );
VERIFY( i4.get_allocator().get_personality() == 42 );
if (std::is_constant_evaluated())
return;
+ const ScopedAlloc scopedAlloc(uneq_allocator<Base>(11), UneqAlloc(22));
std::polymorphic<Base, ScopedAlloc>
- i8(std::allocator_arg, ScopedAlloc(11, 22),
+ i8(std::allocator_arg, scopedAlloc,
std::in_place_type<VecDerived<int, UneqAlloc>>);
VERIFY( *i8 == ze );
VERIFY( i8->get_personality() == 22 );
VERIFY( i8.get_allocator().get_personality() == 11 );
std::polymorphic<Base, ScopedAlloc>
- i9(std::allocator_arg, ScopedAlloc(11, 22),
+ i9(std::allocator_arg, scopedAlloc,
std::in_place_type<VecDerived<int, UneqAlloc>>, 5, 13);
VERIFY( *i9 == fe );
VERIFY( i9->get_personality() == 22 );
VERIFY( i9.get_allocator().get_personality() == 11 );
std::polymorphic<Base, ScopedAlloc>
- i10(std::allocator_arg, ScopedAlloc(11, 22),
+ i10(std::allocator_arg, scopedAlloc,
std::in_place_type<VecDerived<int, UneqAlloc>>, {1, 2, 3, 4});
VERIFY( *i10 == il );
VERIFY( i10->get_personality() == 22 );
uneq_allocator() _GLIBCXX_USE_NOEXCEPT
: personality(0) { }
- _GLIBCXX_CONSTEXPR
+ _GLIBCXX_CONSTEXPR explicit
uneq_allocator(int person) _GLIBCXX_USE_NOEXCEPT
: personality(person) { }