Skip to content

Commit

Permalink
sdf: use an explicit static function to select the appropriate versio…
Browse files Browse the repository at this point in the history
…n of SdfPredicateExpression::GetParseError() to use in Python wrapping

When building using C++20, Boost seems to be unable to correctly deduce which
version of GetParseError() to use when wrapping to Python. This change adds a
static function that ensures the version returning a const reference is used,
which was the original intent.
  • Loading branch information
mattyjams committed Mar 8, 2024
1 parent 38f3f06 commit 7f7cae3
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions pxr/usd/sdf/wrapPredicateExpression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,12 @@ _Repr(SdfPredicateExpression const &self) {
+ TfPyRepr(self.GetText()) + ")";
}
}


static std::string const&
_GetParseError(SdfPredicateExpression const &self) {
return self.GetParseError();
}

void wrapPredicateExpression()
{
TfPyFunctionFromPython<void (PredExpr::Op, int)> {};
Expand Down Expand Up @@ -96,9 +101,7 @@ void wrapPredicateExpression()
.def(self == self)
.def(self != self)

.def("GetParseError",
static_cast<std::string const &(PredExpr::*)() const &>(
&PredExpr::GetParseError),
.def("GetParseError", &_GetParseError,
return_value_policy<return_by_value>())
;

Expand Down

0 comments on commit 7f7cae3

Please # to comment.