From 58bb86fd2f0ecd740fc5bc8078de44221c12c70a Mon Sep 17 00:00:00 2001 From: Steven Le Rouzic <steven.lerouzic@gmail.com> Date: Fri, 22 Nov 2024 17:13:03 +0100 Subject: Add a niche to box --- asl/tests/box_tests.cpp | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) (limited to 'asl/tests/box_tests.cpp') diff --git a/asl/tests/box_tests.cpp b/asl/tests/box_tests.cpp index f1a35f3..3813639 100644 --- a/asl/tests/box_tests.cpp +++ b/asl/tests/box_tests.cpp @@ -4,30 +4,20 @@ #include "asl/tests/test_types.hpp" static_assert(sizeof(asl::box<int>) == sizeof(int*)); -static_assert(asl::default_constructible<asl::box<int>>); static_assert(!asl::copyable<asl::box<int>>); static_assert(asl::moveable<asl::box<int>>); -static_assert(asl::default_constructible<asl::box<NonMoveConstructible>>); +static_assert(asl::has_niche<asl::box<int>>); ASL_TEST(destructor) { bool d = false; { - asl::box<DestructorObserver> box2; - - { - auto box = asl::make_box<DestructorObserver>(&d); - ASL_TEST_ASSERT(!d); - - - auto box3 = ASL_MOVE(box); - ASL_TEST_ASSERT(!d); - - box2 = ASL_MOVE(box3); - ASL_TEST_ASSERT(!d); - } - + auto box = asl::make_box<DestructorObserver>(&d); + ASL_TEST_ASSERT(!d); + + + auto box3 = ASL_MOVE(box); ASL_TEST_ASSERT(!d); } -- cgit