Skip to content

Add unchecked_reference::operator() and operator[] to overload resolution of unchecked_mutable_reference #2514

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

Conversation

YannickJadoul
Copy link
Collaborator

Closes #1468

Given that unchecked_reference is a public base, I think not considering these methods in the overload resolution was an oversight.

I think we could indeed also add const to these methods of unchecked_mutable_reference (similar to std::span or std::reference_wrapper), but this change is less controversial and should fix the most important use cases.

@YannickJadoul YannickJadoul added this to the v2.6.0 milestone Sep 22, 2020
@wjakob
Copy link
Member

wjakob commented Oct 2, 2020

Looks all good to me as well, thanks!

@YannickJadoul YannickJadoul merged commit 56784c4 into pybind:master Oct 2, 2020
@YannickJadoul YannickJadoul deleted the unchecked_mutable_reference-const-methods branch October 2, 2020 17:07
@YannickJadoul
Copy link
Collaborator Author

Thanks for logging this issue and for all the arguing on why this was missing, @MoritzMaxeiner!

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

Successfully merging this pull request may close these issues.

unchecked_mutable_reference element access methods should be const
4 participants