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 PcpNodeRef #2261

Merged
merged 2 commits 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
28 changes: 25 additions & 3 deletions pxr/usd/pcp/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#include "pxr/base/tf/iterator.h"
#include "pxr/base/tf/hashset.h"

#include <boost/operators.hpp>
#include <boost/iterator/iterator_facade.hpp>
#include <boost/iterator/reverse_iterator.hpp>

Expand Down Expand Up @@ -64,8 +63,7 @@ TF_DECLARE_REF_PTRS(PcpPrimIndex_Graph);
/// as well as any value-mapping needed, such as to rename opinions
/// from a model to use in a particular instance.
///
class PcpNodeRef :
public boost::totally_ordered<PcpNodeRef>
class PcpNodeRef
{
public:
typedef PcpNodeRef_ChildrenIterator child_const_iterator;
Expand All @@ -89,12 +87,36 @@ class PcpNodeRef :
return _nodeIdx == rhs._nodeIdx && _graph == rhs._graph;
}

/// Inequality operator
/// \sa PcpNodeRef::operator==(const PcpNodeRef&)
inline bool operator!=(const PcpNodeRef& rhs) const {
return !(*this == rhs);
}

/// Returns true if this node is 'less' than \p rhs.
/// The ordering of nodes is arbitrary and does not indicate the relative
/// strength of the nodes.
PCP_API
bool operator<(const PcpNodeRef& rhs) const;

/// Less than or equal operator
/// \sa PcpNodeRef::operator<(const PcpNodeRef&)
bool operator<=(const PcpNodeRef& rhs) const {
return !(rhs < *this);
}

/// Greater than operator
/// \sa PcpNodeRef::operator<(const PcpNodeRef&)
bool operator>(const PcpNodeRef& rhs) const {
return rhs < *this;
}

/// Greater than or equal operator
/// \sa PcpNodeRef::operator<(const PcpNodeRef&)
bool operator>=(const PcpNodeRef& rhs) const {
return !(*this < rhs);
}

/// Hash functor.
struct Hash {
size_t operator()(const PcpNodeRef& rhs) const
Expand Down