From fbb888e58d38d2b247edb37cb5360e4734df1f17 Mon Sep 17 00:00:00 2001 From: evoskuil Date: Thu, 15 Aug 2024 15:42:25 -0400 Subject: [PATCH] Static assert tests. --- test/allocator.cpp | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/test/allocator.cpp b/test/allocator.cpp index b2e08559ee..dde0d95a8d 100644 --- a/test/allocator.cpp +++ b/test/allocator.cpp @@ -39,8 +39,6 @@ struct simple size_t value; }; -static_assert(std::is_constructible_v); -static_assert(std::is_constructible_v); struct aggregate { @@ -52,9 +50,6 @@ struct aggregate size_t value1; size_t value2; }; -static_assert(std::is_constructible_v); -static_assert(std::is_constructible_v); -static_assert(std::is_constructible_v); struct compound { @@ -67,9 +62,6 @@ struct compound size_t value; data_array<3> bytes; }; -static_assert(std::is_constructible_v); -static_assert(std::is_constructible_v); -static_assert(std::is_constructible_v>); struct hierarchy { @@ -81,9 +73,6 @@ struct hierarchy compound contained; data_chunk chunk; }; -static_assert(std::is_constructible_v); -static_assert(std::is_constructible_v); -static_assert(std::is_constructible_v); struct hierarchy_arena { @@ -96,9 +85,16 @@ struct hierarchy_arena compound contained; data_chunk chunk; }; -static_assert(std::is_constructible_v); -static_assert(std::is_constructible_v); -static_assert(std::is_constructible_v); + +// std_vector and data_chunk are automatically allocator-injected. +// A std_vector of emplaced shared_ptr will be allocator allocated, with +// constructing pointer, deleter copied to allocation. +static_assert(!std::uses_allocator_v); +static_assert(!std::uses_allocator_v, allocator<>>); +static_assert(!std::uses_allocator_v, allocator<>>); +static_assert(!std::uses_allocator_v, allocator<>>); +static_assert(std::uses_allocator_v, allocator<>>); +static_assert(std::uses_allocator_v>); ///////////////////////////////////////////////////////////////////////////////