Please use GitHub pull requests for new patches. Phabricator shutdown timeline
Differential D58879 Diff 199196 test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_types.pass.cpp
Changeset View
Changeset View
Standalone View
Standalone View
test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_types.pass.cpp
Show First 20 Lines • Show All 182 Lines • ▼ Show 20 Lines | void test_non_pmr_uses_alloc(AllocObj const& A, Args&&... args) | ||||
assert(doTestUsesAllocV0<T>(std::forward<Args>(args)...)); | assert(doTestUsesAllocV0<T>(std::forward<Args>(args)...)); | ||||
assert((doTestUsesAllocV1<T>(A, std::forward<Args>(args)...))); | assert((doTestUsesAllocV1<T>(A, std::forward<Args>(args)...))); | ||||
assert((doTestUsesAllocV2<T>(A, std::forward<Args>(args)...))); | assert((doTestUsesAllocV2<T>(A, std::forward<Args>(args)...))); | ||||
} | } | ||||
} | } | ||||
int main(int, char**) | int main(int, char**) | ||||
{ | { | ||||
#if _LIBCPP_STD_VER <= 17 | |||||
using ET = std::experimental::erased_type; | using ET = std::experimental::erased_type; | ||||
using PMR = ex::memory_resource*; | using PMR = ex::memory_resource*; | ||||
using PMA = ex::polymorphic_allocator<void>; | |||||
using STDA = std::allocator<char>; | using STDA = std::allocator<char>; | ||||
using TESTA = test_allocator<char>; | using TESTA = test_allocator<char>; | ||||
#endif // _LIBCPP_STD_VER <= 17 | |||||
using PMA = ex::polymorphic_allocator<void>; | |||||
int value = 42; | int value = 42; | ||||
const int cvalue = 43; | const int cvalue = 43; | ||||
{ | { | ||||
#if _LIBCPP_STD_VER <= 17 | |||||
test_pmr_uses_alloc<ET>(); | test_pmr_uses_alloc<ET>(); | ||||
test_pmr_not_uses_alloc<PMR>(); | test_pmr_not_uses_alloc<PMR>(); | ||||
test_pmr_uses_alloc<PMA>(); | |||||
test_pmr_uses_alloc<ET>(value); | test_pmr_uses_alloc<ET>(value); | ||||
test_pmr_not_uses_alloc<PMR>(value); | test_pmr_not_uses_alloc<PMR>(value); | ||||
test_pmr_uses_alloc<PMA>(value); | |||||
test_pmr_uses_alloc<ET>(cvalue); | test_pmr_uses_alloc<ET>(cvalue); | ||||
test_pmr_not_uses_alloc<PMR>(cvalue); | test_pmr_not_uses_alloc<PMR>(cvalue); | ||||
test_pmr_uses_alloc<PMA>(cvalue); | |||||
test_pmr_uses_alloc<ET>(cvalue, std::move(value)); | test_pmr_uses_alloc<ET>(cvalue, std::move(value)); | ||||
test_pmr_not_uses_alloc<PMR>(cvalue, std::move(value)); | test_pmr_not_uses_alloc<PMR>(cvalue, std::move(value)); | ||||
#endif // _LIBCPP_STD_VER <= 17 | |||||
test_pmr_uses_alloc<PMA>(); | |||||
test_pmr_uses_alloc<PMA>(cvalue); | |||||
test_pmr_uses_alloc<PMA>(value); | |||||
test_pmr_uses_alloc<PMA>(cvalue, std::move(value)); | test_pmr_uses_alloc<PMA>(cvalue, std::move(value)); | ||||
} | } | ||||
#if _LIBCPP_STD_VER <= 17 | |||||
{ | { | ||||
STDA std_alloc; | STDA std_alloc; | ||||
TESTA test_alloc(42); | TESTA test_alloc(42); | ||||
test_non_pmr_uses_alloc<STDA>(std_alloc); | test_non_pmr_uses_alloc<STDA>(std_alloc); | ||||
test_non_pmr_uses_alloc<TESTA>(test_alloc); | test_non_pmr_uses_alloc<TESTA>(test_alloc); | ||||
test_non_pmr_uses_alloc<STDA>(std_alloc, value); | test_non_pmr_uses_alloc<STDA>(std_alloc, value); | ||||
test_non_pmr_uses_alloc<TESTA>(test_alloc, value); | test_non_pmr_uses_alloc<TESTA>(test_alloc, value); | ||||
test_non_pmr_uses_alloc<STDA>(std_alloc, cvalue); | test_non_pmr_uses_alloc<STDA>(std_alloc, cvalue); | ||||
test_non_pmr_uses_alloc<TESTA>(test_alloc, cvalue); | test_non_pmr_uses_alloc<TESTA>(test_alloc, cvalue); | ||||
test_non_pmr_uses_alloc<STDA>(std_alloc, cvalue, std::move(value)); | test_non_pmr_uses_alloc<STDA>(std_alloc, cvalue, std::move(value)); | ||||
test_non_pmr_uses_alloc<TESTA>(test_alloc, cvalue, std::move(value)); | test_non_pmr_uses_alloc<TESTA>(test_alloc, cvalue, std::move(value)); | ||||
} | } | ||||
#endif // _LIBCPP_STD_VER <= 17 | |||||
return 0; | return 0; | ||||
} | } |