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_piecewise_pair.pass.cpp
Changeset View
Changeset View
Standalone View
Standalone View
test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_piecewise_pair.pass.cpp
Show First 20 Lines • Show All 106 Lines • ▼ Show 20 Lines | void test_pmr_not_uses_allocator(std::tuple<TTypes...> ttuple, std::tuple<UTypes...> utuple) | ||||
using U = NotUsesAllocator<Alloc, sizeof...(UTypes)>; | using U = NotUsesAllocator<Alloc, sizeof...(UTypes)>; | ||||
assert((doTest<T, U>(UA_None, UA_None, | assert((doTest<T, U>(UA_None, UA_None, | ||||
std::move(ttuple), std::move(utuple)))); | std::move(ttuple), std::move(utuple)))); | ||||
} | } | ||||
} | } | ||||
int main(int, char**) | int main(int, char**) | ||||
{ | { | ||||
#if _LIBCPP_STD_VER <= 17 | |||||
using ERT = std::experimental::erased_type; | using ERT = std::experimental::erased_type; | ||||
using PMR = ex::memory_resource*; | using PMR = ex::memory_resource*; | ||||
#endif // _LIBCPP_STD_VER <= 17 | |||||
using PMA = ex::polymorphic_allocator<char>; | using PMA = ex::polymorphic_allocator<char>; | ||||
{ | { | ||||
std::tuple<> t1; | std::tuple<> t1; | ||||
#if _LIBCPP_STD_VER <= 17 | |||||
test_pmr_uses_allocator<ERT>(t1, t1); | test_pmr_uses_allocator<ERT>(t1, t1); | ||||
test_pmr_not_uses_allocator<PMR>(t1, t1); | test_pmr_not_uses_allocator<PMR>(t1, t1); | ||||
#endif // _LIBCPP_STD_VER <= 17 | |||||
test_pmr_uses_allocator<PMA>(t1, t1); | test_pmr_uses_allocator<PMA>(t1, t1); | ||||
} | } | ||||
{ | { | ||||
std::tuple<int> t1(42); | std::tuple<int> t1(42); | ||||
std::tuple<> t2; | std::tuple<> t2; | ||||
#if _LIBCPP_STD_VER <= 17 | |||||
test_pmr_uses_allocator<ERT>(t1, t2); | test_pmr_uses_allocator<ERT>(t1, t2); | ||||
test_pmr_uses_allocator<ERT>(t2, t1); | test_pmr_uses_allocator<ERT>(t2, t1); | ||||
test_pmr_not_uses_allocator<PMR>(t1, t2); | test_pmr_not_uses_allocator<PMR>(t1, t2); | ||||
test_pmr_not_uses_allocator<PMR>(t2, t1); | test_pmr_not_uses_allocator<PMR>(t2, t1); | ||||
#endif // _LIBCPP_STD_VER <= 17 | |||||
test_pmr_uses_allocator<PMA>(t1, t2); | test_pmr_uses_allocator<PMA>(t1, t2); | ||||
test_pmr_uses_allocator<PMA>(t2, t1); | test_pmr_uses_allocator<PMA>(t2, t1); | ||||
} | } | ||||
{ | { | ||||
std::tuple<int> t1(42); | std::tuple<int> t1(42); | ||||
int x = 55; | int x = 55; | ||||
double dx = 42.42; | double dx = 42.42; | ||||
std::tuple<int&, double&&> t2(x, std::move(dx)); | std::tuple<int&, double&&> t2(x, std::move(dx)); | ||||
#if _LIBCPP_STD_VER <= 17 | |||||
test_pmr_uses_allocator<ERT>( t1, std::move(t2)); | test_pmr_uses_allocator<ERT>( t1, std::move(t2)); | ||||
test_pmr_uses_allocator<ERT>(std::move(t2), t1); | test_pmr_uses_allocator<ERT>(std::move(t2), t1); | ||||
test_pmr_not_uses_allocator<PMR>( t1, std::move(t2)); | test_pmr_not_uses_allocator<PMR>( t1, std::move(t2)); | ||||
test_pmr_not_uses_allocator<PMR>(std::move(t2), t1); | test_pmr_not_uses_allocator<PMR>(std::move(t2), t1); | ||||
#endif // _LIBCPP_STD_VER <= 17 | |||||
test_pmr_uses_allocator<PMA>( t1, std::move(t2)); | test_pmr_uses_allocator<PMA>( t1, std::move(t2)); | ||||
test_pmr_uses_allocator<PMA>(std::move(t2), t1); | test_pmr_uses_allocator<PMA>(std::move(t2), t1); | ||||
} | } | ||||
{ | { | ||||
void* xptr = nullptr; | void* xptr = nullptr; | ||||
long y = 4242; | long y = 4242; | ||||
std::tuple<int, long const&, void*&> t1(42, y, xptr); | std::tuple<int, long const&, void*&> t1(42, y, xptr); | ||||
int x = 55; | int x = 55; | ||||
double dx = 42.42; | double dx = 42.42; | ||||
const char* s = "hello World"; | const char* s = "hello World"; | ||||
std::tuple<int&, double&&, const char*> t2(x, std::move(dx), s); | std::tuple<int&, double&&, const char*> t2(x, std::move(dx), s); | ||||
#if _LIBCPP_STD_VER <= 17 | |||||
test_pmr_uses_allocator<ERT>( t1, std::move(t2)); | test_pmr_uses_allocator<ERT>( t1, std::move(t2)); | ||||
test_pmr_uses_allocator<ERT>(std::move(t2), t1); | test_pmr_uses_allocator<ERT>(std::move(t2), t1); | ||||
test_pmr_not_uses_allocator<PMR>( t1, std::move(t2)); | test_pmr_not_uses_allocator<PMR>( t1, std::move(t2)); | ||||
test_pmr_not_uses_allocator<PMR>(std::move(t2), t1); | test_pmr_not_uses_allocator<PMR>(std::move(t2), t1); | ||||
#endif // _LIBCPP_STD_VER <= 17 | |||||
test_pmr_uses_allocator<PMA>( t1, std::move(t2)); | test_pmr_uses_allocator<PMA>( t1, std::move(t2)); | ||||
test_pmr_uses_allocator<PMA>(std::move(t2), t1); | test_pmr_uses_allocator<PMA>(std::move(t2), t1); | ||||
} | } | ||||
return 0; | return 0; | ||||
} | } |