From 65f0b622e390edb39a6cfd8d614374314472a5a9 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Sat, 28 Dec 2019 17:22:06 +0100 Subject: new_type: add equality comparison tests --- include/newtype/new_type.hpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/newtype/new_type.hpp b/include/newtype/new_type.hpp index 67e29c3..c0fb8d3 100644 --- a/include/newtype/new_type.hpp +++ b/include/newtype/new_type.hpp @@ -134,7 +134,9 @@ namespace nt */ template auto constexpr operator==(new_type const & lhs, - new_type const & rhs) noexcept(noexcept(lhs.decay() == rhs.decay())) -> bool + new_type const & rhs) noexcept(noexcept(std::declval() == + std::declval())) + -> bool { return lhs.decay() == rhs.decay(); } @@ -144,9 +146,11 @@ namespace nt */ template auto constexpr operator!=(new_type const & lhs, - new_type const & rhs) noexcept(noexcept(!(lhs == rhs))) -> bool + new_type const & rhs) noexcept(noexcept(std::declval() != + std::declval())) + -> bool { - return !(lhs == rhs); + return lhs.decay() != rhs.decay(); } } // namespace nt -- cgit v1.2.3