You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
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.
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.
Is there an equivalent (uncomplicated) C++way of doing this?
The C-style cast here is deliberate because variant might be a private base of Self. This is a case that std::visit does not support, but LEWG preferred if member visit did.
Is there an equivalent (uncomplicated) C++way of doing this?
I don't believe there's any, unfortunately. I think if there were, MSVC STL wouldn't drop uses of explicit object parameters in expected. See also microsoft/STL#2643 (comment).
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: