From ed3693fd2e6d3dcc20acb6be23cfbf2d1cbb8ecd Mon Sep 17 00:00:00 2001 From: Zac Hansen Date: Sat, 3 Mar 2018 15:53:23 -0800 Subject: [PATCH] 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 --- include/gsl/pointers | 1 + tests/notnull_tests.cpp | 2 ++ 2 files changed, 3 insertions(+) diff --git a/include/gsl/pointers b/include/gsl/pointers index 163a2fe..b2804a3 100644 --- a/include/gsl/pointers +++ b/include/gsl/pointers @@ -82,6 +82,7 @@ public: { } + not_null(not_null&& other) = default; not_null(const not_null& other) = default; not_null& operator=(const not_null& other) = default; diff --git a/tests/notnull_tests.cpp b/tests/notnull_tests.cpp index 4baf7b3..a7ef27e 100644 --- a/tests/notnull_tests.cpp +++ b/tests/notnull_tests.cpp @@ -327,3 +327,5 @@ TEST_CASE("TestNotNullCustomPtrComparison") CHECK((NotNull1(p1) >= NotNull2(p2)) == (p1 >= p2)); CHECK((NotNull2(p2) >= NotNull1(p1)) == (p2 >= p1)); } + +static_assert(std::is_nothrow_move_constructible>::value, "not_null must be no-throw move constructible");