Please use GitHub pull requests for new patches. Phabricator shutdown timeline
Differential D58879 Diff 199196 test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_type.pass.cpp
Changeset View
Changeset View
Standalone View
Standalone View
test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_type.pass.cpp
Show First 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | AllocController PInner; | ||||
Outer O(POuter); | Outer O(POuter); | ||||
Inner I(PInner); | Inner I(PInner); | ||||
SA A(O, I); | SA A(O, I); | ||||
int x = 42; | int x = 42; | ||||
int const& cx = x; | int const& cx = x; | ||||
A.construct(ptr, x, cx, std::move(x)); | A.construct(ptr, x, cx, std::move(x)); | ||||
assert((checkConstruct<int&, int const&, int&&>(*ptr, UA_AllocArg, I))); | assert((checkConstruct<int&, int const&, int&&>(*ptr, UA_AllocArg, I))); | ||||
assert((POuter.checkConstruct<std::allocator_arg_t const&, | assert((POuter.checkConstruct<std::allocator_arg_t const&, | ||||
SA::inner_allocator_type&, int&, int const&, int&&>(O, ptr))); | SA::inner_allocator_type const&, int&, int const&, int&&>(O, ptr))); | ||||
A.destroy(ptr); | A.destroy(ptr); | ||||
::operator delete((void*)ptr); | ::operator delete((void*)ptr); | ||||
} | } | ||||
PInner.reset(); | PInner.reset(); | ||||
POuter.reset(); | POuter.reset(); | ||||
} | } | ||||
// Otherwise, if uses_allocator_v<T, inner_allocator_type> is true and | // Otherwise, if uses_allocator_v<T, inner_allocator_type> is true and | ||||
Show All 17 Lines | AllocController PInner; | ||||
Inner I(PInner); | Inner I(PInner); | ||||
SA A(O, I); | SA A(O, I); | ||||
int x = 42; | int x = 42; | ||||
int const& cx = x; | int const& cx = x; | ||||
A.construct(ptr, x, cx, std::move(x)); | A.construct(ptr, x, cx, std::move(x)); | ||||
assert((checkConstruct<int&, int const&, int&&>(*ptr, UA_AllocLast, I))); | assert((checkConstruct<int&, int const&, int&&>(*ptr, UA_AllocLast, I))); | ||||
assert((POuter.checkConstruct< | assert((POuter.checkConstruct< | ||||
int&, int const&, int&&, | int&, int const&, int&&, | ||||
SA::inner_allocator_type&>(O, ptr))); | SA::inner_allocator_type const&>(O, ptr))); | ||||
A.destroy(ptr); | A.destroy(ptr); | ||||
::operator delete((void*)ptr); | ::operator delete((void*)ptr); | ||||
} | } | ||||
PInner.reset(); | PInner.reset(); | ||||
POuter.reset(); | POuter.reset(); | ||||
} | } | ||||
int main(int, char**) { | int main(int, char**) { | ||||
test_bullet_one(); | test_bullet_one(); | ||||
test_bullet_two(); | test_bullet_two(); | ||||
test_bullet_three(); | test_bullet_three(); | ||||
return 0; | return 0; | ||||
} | } |