sol2
sol2 copied to clipboard
Exposing usertype via custom pointer requires comparison operators
Exposing a usertype via a custom pointer class forces the usertype to implement all comparison operators, if the custom pointer class provides them.
The code that triggers this is usertype_core.hpp:132. The code checks that T has those operators and forwards that to comparsion_operator_wrap. The problem is that comparsion_operator_wrap internally uses deref which then tries to compare the underlying type which might not have these operators implemented.
Here's a godbolt repro: https://godbolt.org/z/fEvcd889E
I would except it to be enough that the pointer type is comparable. Using std::shared_ptr instead of the custom pointer class works as expected.
Keep up the good work!