diff --git a/pxr/base/tf/pyAnnotatedBoolResult.h b/pxr/base/tf/pyAnnotatedBoolResult.h index 7b9ec8315b..ee33a7bf05 100644 --- a/pxr/base/tf/pyAnnotatedBoolResult.h +++ b/pxr/base/tf/pyAnnotatedBoolResult.h @@ -29,7 +29,6 @@ #include "pxr/base/tf/pyLock.h" #include "pxr/base/tf/pyUtils.h" -#include #include #include #include @@ -39,8 +38,7 @@ PXR_NAMESPACE_OPEN_SCOPE template -struct TfPyAnnotatedBoolResult : - boost::equality_comparable, bool> +struct TfPyAnnotatedBoolResult { TfPyAnnotatedBoolResult() {} @@ -65,6 +63,18 @@ struct TfPyAnnotatedBoolResult : return _val == rhs; } + friend bool operator==(bool lhs, const TfPyAnnotatedBoolResult& rhs) { + return rhs == lhs; + } + + friend bool operator!=(const TfPyAnnotatedBoolResult& lhs, bool rhs) { + return !(lhs == rhs); + } + + friend bool operator!=(bool lhs, const TfPyAnnotatedBoolResult& rhs) { + return !(lhs == rhs); + } + template static boost::python::class_ Wrap(char const *name, char const *annotationName) { diff --git a/pxr/base/tf/pyEnum.h b/pxr/base/tf/pyEnum.h index 754e674aeb..114695a66e 100644 --- a/pxr/base/tf/pyEnum.h +++ b/pxr/base/tf/pyEnum.h @@ -168,8 +168,7 @@ std::string Tf_PyEnumRepr(boost::python::object const &self); // Private base class for types which are instantiated and exposed to python // for each registered enum type. -struct Tf_PyEnumWrapper - : public Tf_PyEnum, boost::totally_ordered +struct Tf_PyEnumWrapper : public Tf_PyEnum { typedef Tf_PyEnumWrapper This; @@ -197,6 +196,11 @@ struct Tf_PyEnumWrapper return lhs.value == rhs.value; } + friend bool operator !=(Tf_PyEnumWrapper const &lhs, + Tf_PyEnumWrapper const &rhs) { + return !(lhs == rhs); + } + friend bool operator <(Tf_PyEnumWrapper const &lhs, Tf_PyEnumWrapper const &rhs) { @@ -210,7 +214,25 @@ struct Tf_PyEnumWrapper // If types do match, numerically compare values. return lhs.GetValue() < rhs.GetValue(); } - + + friend bool operator >(Tf_PyEnumWrapper const& lhs, + Tf_PyEnumWrapper const& rhs) + { + return rhs < lhs; + } + + friend bool operator <=(Tf_PyEnumWrapper const& lhs, + Tf_PyEnumWrapper const& rhs) + { + return !(lhs > rhs); + } + + friend bool operator >=(Tf_PyEnumWrapper const& lhs, + Tf_PyEnumWrapper const& rhs) + { + return !(lhs < rhs); + } + // // XXX Bitwise operators for Enums are a temporary measure to support the // use of Enums as Bitmasks in libSd. It should be noted that Enums are