From 29297e7dacd4387c35f1694ede901553e78ea8d3 Mon Sep 17 00:00:00 2001 From: Werner Henze Date: Fri, 24 Apr 2020 11:10:09 +0200 Subject: [PATCH] noexcept for make_(strict_)not_null and not_null comparisons --- include/gsl/pointers | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/include/gsl/pointers b/include/gsl/pointers index 1caf294..543be80 100644 --- a/include/gsl/pointers +++ b/include/gsl/pointers @@ -119,7 +119,7 @@ private: }; template -auto make_not_null(T&& t) { +auto make_not_null(T&& t) noexcept { return not_null>>{std::forward(t)}; } @@ -131,37 +131,37 @@ std::ostream& operator<<(std::ostream& os, const not_null& val) } template -auto operator==(const not_null& lhs, const not_null& rhs) -> decltype(lhs.get() == rhs.get()) +auto operator==(const not_null& lhs, const not_null& rhs) noexcept(noexcept(lhs.get() == rhs.get())) -> decltype(lhs.get() == rhs.get()) { return lhs.get() == rhs.get(); } template -auto operator!=(const not_null& lhs, const not_null& rhs) -> decltype(lhs.get() != rhs.get()) +auto operator!=(const not_null& lhs, const not_null& rhs) noexcept(noexcept(lhs.get() != rhs.get())) -> decltype(lhs.get() != rhs.get()) { return lhs.get() != rhs.get(); } template -auto operator<(const not_null& lhs, const not_null& rhs) -> decltype(lhs.get() < rhs.get()) +auto operator<(const not_null& lhs, const not_null& rhs) noexcept(noexcept(lhs.get() < rhs.get())) -> decltype(lhs.get() < rhs.get()) { return lhs.get() < rhs.get(); } template -auto operator<=(const not_null& lhs, const not_null& rhs) -> decltype(lhs.get() <= rhs.get()) +auto operator<=(const not_null& lhs, const not_null& rhs) noexcept(noexcept(lhs.get() <= rhs.get())) -> decltype(lhs.get() <= rhs.get()) { return lhs.get() <= rhs.get(); } template -auto operator>(const not_null& lhs, const not_null& rhs) -> decltype(lhs.get() > rhs.get()) +auto operator>(const not_null& lhs, const not_null& rhs) noexcept(noexcept(lhs.get() > rhs.get())) -> decltype(lhs.get() > rhs.get()) { return lhs.get() > rhs.get(); } template -auto operator>=(const not_null& lhs, const not_null& rhs) -> decltype(lhs.get() >= rhs.get()) +auto operator>=(const not_null& lhs, const not_null& rhs) noexcept(noexcept(lhs.get() >= rhs.get())) -> decltype(lhs.get() >= rhs.get()) { return lhs.get() >= rhs.get(); } @@ -267,7 +267,7 @@ template strict_not_null operator+(std::ptrdiff_t, const strict_not_null&) = delete; template -auto make_strict_not_null(T&& t) { +auto make_strict_not_null(T&& t) noexcept { return strict_not_null>>{std::forward(t)}; }