Skip to content
Snippets Groups Projects
Commit 62553077 authored by Joseph Walton-Rivers's avatar Joseph Walton-Rivers
Browse files

document type-safe wrapper

parent 734e07fd
No related branches found
No related tags found
No related merge requests found
......@@ -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);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment