aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/newtype/new_type.hpp24
1 files changed, 22 insertions, 2 deletions
diff --git a/include/newtype/new_type.hpp b/include/newtype/new_type.hpp
index 0dc0ff6..68a22dd 100644
--- a/include/newtype/new_type.hpp
+++ b/include/newtype/new_type.hpp
@@ -107,7 +107,7 @@ namespace nt
/**
* Convert this instance into the equivalent base type value
*
- * @note This overload participates only in overload resolution if the derication clause of this @p new_type contains
+ * @note This overload participates only in overload resolution if the derivation clause of this @p new_type contains
* nt::ImplicitConversion
*/
template<typename NewType = new_type, std::enable_if_t<NewType::derivations(nt::ImplicitConversion)> * = nullptr>
@@ -119,7 +119,7 @@ namespace nt
/**
* Convert this instance into the equivalent base type value
*
- * @note This overload participates only in overload resolution if the derication clause of this @p new_type does not contain
+ * @note This overload participates only in overload resolution if the derivation clause of this @p new_type does not contain
* nt::ImplicitConversion
*/
template<typename NewType = new_type, std::enable_if_t<!NewType::derivations(nt::ImplicitConversion)> * = nullptr>
@@ -129,6 +129,26 @@ namespace nt
}
};
+ /**
+ * Compare two objects for equality
+ */
+ template<typename BaseType, typename TagType, auto DerivationClause>
+ auto constexpr operator==(new_type<BaseType, TagType, DerivationClause> const & lhs,
+ new_type<BaseType, TagType, DerivationClause> const & rhs) noexcept(noexcept(lhs.decay() == rhs.decay())) -> bool
+ {
+ return lhs.decay() == rhs.decay();
+ }
+
+ /**
+ * Compare two objects for non-equality
+ */
+ template<typename BaseType, typename TagType, auto DerivationClause>
+ auto constexpr operator!=(new_type<BaseType, TagType, DerivationClause> const & lhs,
+ new_type<BaseType, TagType, DerivationClause> const & rhs) noexcept(noexcept(!(lhs == rhs))) -> bool
+ {
+ return !(lhs == rhs);
+ }
+
} // namespace nt
#endif