Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace boost::totally_ordered with explicit operator overloads for TfAnyWeakPtr #2252

Merged
merged 1 commit into from
Jul 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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