Skip to content

Commit

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

(Internal change: 2282457)
  • Loading branch information
pixar-oss committed Jun 23, 2023
2 parents 5860ca6 + 76f4de0 commit f9e9477
Showing 1 changed file with 25 additions and 3 deletions.
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

0 comments on commit f9e9477

Please sign in to comment.