diff --git a/include/fggl/util/safety.hpp b/include/fggl/util/safety.hpp index 1daf295d1df7de35889e143bc37d6d3adf4e0e83..cd5719aff6ddbd426483d35fbc84118e264314f0 100644 --- a/include/fggl/util/safety.hpp +++ b/include/fggl/util/safety.hpp @@ -49,12 +49,30 @@ namespace fggl::util { constexpr explicit operator std::string_view() const { return m_value; } + /** + * Check for equality of two handles. + * + * Two values are considered the same of the values contained inside them are considered equal, and both + * types share the same tagging interface. + * + * @param other the value being compared against. + * @return true iff the contained values are equal + */ bool operator==(const OpaqueName<T, Tag> &other) const { return m_value == other.m_value; } + /** + * Check for equality of two handles. + * + * Two values are considered the same of the values contained inside them are considered equal, and both + * types share the same tagging interface. + * + * @param other the value being compared against. + * @return true iff the contained values are not equal + */ bool operator!=(const OpaqueName<T, Tag> &other) const { - return !(*this == other); + return m_value != other.m_value; } bool operator<(const OpaqueName<T, Tag> &other) const { @@ -65,6 +83,9 @@ namespace fggl::util { return m_value <=> other.m_value; } + /** + * Generate a new tagged instance of a handle. + */ constexpr static OpaqueName<T, Tag> make(T value) { return OpaqueName<T, Tag>(value); }