From 27eeea4204cd893e19319be4de11dfb76f287c64 Mon Sep 17 00:00:00 2001 From: Matt Kuruc Date: Wed, 8 Feb 2023 13:02:58 -0800 Subject: [PATCH 1/2] Replace `boost::totally_ordered` with explicit operator overloads for `PcpNodeRef` --- pxr/usd/pcp/node.h | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/pxr/usd/pcp/node.h b/pxr/usd/pcp/node.h index 00a57a1131..084f52c88a 100644 --- a/pxr/usd/pcp/node.h +++ b/pxr/usd/pcp/node.h @@ -31,7 +31,6 @@ #include "pxr/base/tf/iterator.h" #include "pxr/base/tf/hashset.h" -#include #include #include @@ -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 +class PcpNodeRef { public: typedef PcpNodeRef_ChildrenIterator child_const_iterator; @@ -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::PcpNodeRef<(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 From 76f4de006473b969bf744983766882170092051a Mon Sep 17 00:00:00 2001 From: Matt Kuruc Date: Wed, 21 Jun 2023 14:21:46 -0700 Subject: [PATCH 2/2] Fix doxygen comment --- pxr/usd/pcp/node.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pxr/usd/pcp/node.h b/pxr/usd/pcp/node.h index 084f52c88a..a66070366c 100644 --- a/pxr/usd/pcp/node.h +++ b/pxr/usd/pcp/node.h @@ -106,7 +106,7 @@ class PcpNodeRef } /// Greater than operator - /// \sa PcpNodeRef::PcpNodeRef<(const PcpNodeRef&) + /// \sa PcpNodeRef::operator<(const PcpNodeRef&) bool operator>(const PcpNodeRef& rhs) const { return rhs < *this; }