-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
avoid some const_cast
usage
#4344
Conversation
doesn't |
I don't know. I was surprised that |
I do not feel our code is super elegant. An alternative would be to create a common private const function that is called both from the const and non-const method. We don't need to explicitly cast at all then. |
I am looking into this (also as preparation for |
ok I close this PR for now.. but feel free to clean up the code.. |
This would require introducing additional private This PR still gets rid of unnecessary/incorrected |
I feel that static_cast is even worse than const_cast though. const_cast is more strict. |
|
If the casts would change the type then const_cast would generate a compiler error right? So it seems it just casts away the constness. |
I assumed that |
Aren't those instances the canonical use case for |
Partially superseded by #5720. Still lacks the |
#5720 also includes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me.
No description provided.