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

Exposing usertype via custom pointer requires comparison operators #1264

Open
gotschmarcel-ni opened this issue Oct 28, 2021 · 0 comments
Open

Comments

@gotschmarcel-ni
Copy link
Contributor

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant