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 SdfMapEditProxy #2506

Merged
merged 1 commit into from
Jul 27, 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
49 changes: 46 additions & 3 deletions pxr/usd/sdf/mapEditProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
#include "pxr/base/tf/mallocTag.h"
#include <boost/iterator/iterator_facade.hpp>
#include <boost/iterator/reverse_iterator.hpp>
#include <boost/operators.hpp>
#include <iterator>
#include <utility>

Expand Down Expand Up @@ -117,8 +116,7 @@ class SdfIdentityMapEditProxyValuePolicy {
/// \sa SdfIdentityMapEditProxyValuePolicy
///
template <class T, class _ValuePolicy = SdfIdentityMapEditProxyValuePolicy<T> >
class SdfMapEditProxy :
boost::totally_ordered<SdfMapEditProxy<T, _ValuePolicy>, T> {
class SdfMapEditProxy {
public:
typedef T Type;
typedef _ValuePolicy ValuePolicy;
Expand Down Expand Up @@ -578,6 +576,21 @@ class SdfMapEditProxy :
return _Validate() ? _CompareEqual(other) : false;
}

bool operator!=(const Type& other) const
{
return !(*this == other);
}

friend bool operator==(const Type& lhs, const SdfMapEditProxy& rhs)
{
return rhs == lhs;
}

friend bool operator!=(const Type& lhs, const SdfMapEditProxy& rhs)
{
return rhs != lhs;
}

bool operator<(const Type& other) const
{
return _Validate() ? _Compare(other) < 0 : false;
Expand All @@ -588,6 +601,36 @@ class SdfMapEditProxy :
return _Validate() ? _Compare(other) > 0 : false;
}

bool operator>=(const Type& other) const
{
return !(*this < other);
}

bool operator<=(const Type& other) const
{
return !(*this > other);
}

friend bool operator<(const Type& lhs, const SdfMapEditProxy& rhs)
{
return rhs > lhs;
}

friend bool operator>(const Type& lhs, const SdfMapEditProxy& rhs)
{
return rhs < lhs;
}

friend bool operator<=(const Type& lhs, const SdfMapEditProxy& rhs)
{
return rhs >= lhs;
}

friend bool operator>=(const Type& lhs, const SdfMapEditProxy& rhs)
{
return rhs <= lhs;
}

template <class U, class UVP>
bool operator==(const SdfMapEditProxy<U, UVP>& other) const
{
Expand Down