Skip to content

Commit

Permalink
Merge pull request #2252 from nvmkuruc/tfanyweakptrordered
Browse files Browse the repository at this point in the history
Replace `boost::totally_ordered` with explicit operator overloads for `TfAnyWeakPtr`

(Internal change: 2282226)
  • Loading branch information
pixar-oss committed Jun 21, 2023
2 parents 2852e03 + 47bd553 commit 6513d6c
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions pxr/base/tf/anyWeakPtr.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
#endif // PXR_PYTHON_SUPPORT_ENABLED

#include "pxr/base/tf/pyObjWrapper.h"
#include <boost/operators.hpp>

#include <cstddef>
#include <type_traits>
Expand All @@ -51,7 +50,7 @@ PXR_NAMESPACE_OPEN_SCOPE
///
/// Provides the ability to hold an arbitrary TfWeakPtr in a non-type-specific
/// manner in order to observe whether it has expired or not
class TfAnyWeakPtr : boost::totally_ordered<TfAnyWeakPtr>
class TfAnyWeakPtr
{
struct _Data {
void* space[4];
Expand Down Expand Up @@ -118,9 +117,29 @@ class TfAnyWeakPtr : boost::totally_ordered<TfAnyWeakPtr>
/// equality operator
TF_API bool operator ==(const TfAnyWeakPtr &rhs) const;

/// inequality operator
bool operator !=(const TfAnyWeakPtr &rhs) const {
return !(*this == rhs);
}

/// comparison operator
TF_API bool operator <(const TfAnyWeakPtr &rhs) const;

/// less than or equal operator
bool operator <=(const TfAnyWeakPtr& rhs) const {
return !(rhs < *this);
}

/// greater than operator
bool operator >(const TfAnyWeakPtr& rhs) const {
return rhs < *this;
}

/// greater than or equal operator
bool operator >=(const TfAnyWeakPtr& rhs) const {
return !(*this < rhs);
}

/// returns the type_info of the underlying WeakPtr
TF_API const std::type_info & GetTypeInfo() const;

Expand Down

0 comments on commit 6513d6c

Please sign in to comment.