make explicit not_null move constructor so it is noexcept (#630)

* make explicit not_null move constructor so it is noexcept

* added test for not_null being noexcet move constructible
This commit is contained in:
Zac Hansen 2018-03-03 15:53:23 -08:00 committed by Neil MacIntosh
parent 7eb8f41af5
commit ed3693fd2e
2 changed files with 3 additions and 0 deletions

View File

@ -82,6 +82,7 @@ public:
{ {
} }
not_null(not_null&& other) = default;
not_null(const not_null& other) = default; not_null(const not_null& other) = default;
not_null& operator=(const not_null& other) = default; not_null& operator=(const not_null& other) = default;

View File

@ -327,3 +327,5 @@ TEST_CASE("TestNotNullCustomPtrComparison")
CHECK((NotNull1(p1) >= NotNull2(p2)) == (p1 >= p2)); CHECK((NotNull1(p1) >= NotNull2(p2)) == (p1 >= p2));
CHECK((NotNull2(p2) >= NotNull1(p1)) == (p2 >= p1)); CHECK((NotNull2(p2) >= NotNull1(p1)) == (p2 >= p1));
} }
static_assert(std::is_nothrow_move_constructible<not_null<void *>>::value, "not_null must be no-throw move constructible");