-
Notifications
You must be signed in to change notification settings - Fork 748
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
[variant.visit] C-style casting in visit
member
#7130
Comments
C-style casts are necessary in explicit object member functions to access members of a potentially inaccessible base class (https://godbolt.org/z/Gb6vzzY9r). This C-style cast is load-bearing. |
Thanks for your correction, I think I missed that, sorry. |
Quoted from P2637R3:
I don't believe there's any, unfortunately. I think if there were, MSVC STL wouldn't drop uses of explicit object parameters in |
The two member
visit
have c-style casting(V)self
in [variant.visit].From my understanding, using C-style casting is not a best practice and should be avoided.
Would be better to use
static_cast
(not clear whether the two are completely equivalent in such cases)?The text was updated successfully, but these errors were encountered: