Add ordering comparison operators
This commit is contained in:
1 parent
d9a9a88a24
commit
17a647b897
2 files changed
+53
No files matched your search
@@ -172,6 +172,38 @@ public:
|
||||
return static_cast<const void *>(ptr) != static_cast<const void *>(other.ptr);
|
||||
}
|
||||
|
||||
template <typename U>
|
||||
bool operator<(const rcp<U> & other) const
|
||||
{
|
||||
return std::less<const void *>()(
|
||||
static_cast<const void *>(ptr),
|
||||
static_cast<const void *>(other.ptr));
|
||||
}
|
||||
|
||||
template <typename U>
|
||||
bool operator<=(const rcp<U> & other) const
|
||||
{
|
||||
return !std::less<const void *>()(
|
||||
static_cast<const void *>(other.ptr),
|
||||
static_cast<const void *>(ptr));
|
||||
}
|
||||
|
||||
template <typename U>
|
||||
bool operator>(const rcp<U> & other) const
|
||||
{
|
||||
return std::less<const void *>()(
|
||||
static_cast<const void *>(other.ptr),
|
||||
static_cast<const void *>(ptr));
|
||||
}
|
||||
|
||||
template <typename U>
|
||||
bool operator>=(const rcp<U> & other) const
|
||||
{
|
||||
return !std::less<const void *>()(
|
||||
static_cast<const void *>(ptr),
|
||||
static_cast<const void *>(other.ptr));
|
||||
}
|
||||
|
||||
bool operator==(std::nullptr_t) const
|
||||
{
|
||||
return ptr == nullptr;
|
||||
|
||||
Reference in new issue
Block a user