strongdef: make equality operator constexpr
This commit is contained in:
parent
5a3165d233
commit
b70a84c9be
@ -64,13 +64,22 @@ namespace util {
|
|||||||
// prevents the conversion operator getting invoked and falsely
|
// prevents the conversion operator getting invoked and falsely
|
||||||
// allowing equality with different types or tags.
|
// allowing equality with different types or tags.
|
||||||
template <typename U, typename TagU>
|
template <typename U, typename TagU>
|
||||||
std::enable_if_t<!std::is_same<T,U>::value || !std::is_same<Tag,TagU>::value,bool>
|
std::enable_if_t<
|
||||||
operator== (const strongdef<U,TagU> &rhs) = delete;
|
!std::is_same<T,U>::value ||
|
||||||
|
!std::is_same<Tag,TagU>::value,
|
||||||
|
bool
|
||||||
|
>
|
||||||
|
operator== (const strongdef<U,TagU> &rhs) const = delete;
|
||||||
|
|
||||||
// provide a usable equality for equal types and tags
|
// provide a usable equality for equal types and tags
|
||||||
template <typename U, typename TagU>
|
template <typename U, typename TagU>
|
||||||
std::enable_if_t<std::is_same<T,U>::value && std::is_same<Tag,TagU>::value,bool>
|
constexpr
|
||||||
operator== (const strongdef<U,TagU> &rhs) { return data == rhs.data; }
|
std::enable_if_t<
|
||||||
|
std::is_same<T,U>::value &&
|
||||||
|
std::is_same<Tag,TagU>::value,
|
||||||
|
bool
|
||||||
|
>
|
||||||
|
operator== (const strongdef<U,TagU> &rhs) const { return data == rhs.data; }
|
||||||
|
|
||||||
T data;
|
T data;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user