-
Notifications
You must be signed in to change notification settings - Fork 231
refactor: simpler type check in Acts::Any #4993
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
base: main
Are you sure you want to change the base?
Conversation
|
|
Thanks @timadye. I think this is exactly what we're had in This exactly exhibits the problem: the pointers will point at different addresses in different shared libraries and the check then returns false, identifying them as separate types. The pointer comparison in the assignment operator is likely a bug I think. |
|
Sorry, I didn't see that you'd tried this before. I think I see how yours might work. The pattern is the same. In each case you are relying on a In that case, you rely on However, according to cppreference, the only things guaranteed to match are comparing libstdc++'s
I think it does both for speed, and so it mostly works even if RTTI isn't available. I think we could do something similar by caching a pointer to the I can try that... |
|
We just need to make sure that this then actually works, also in @wdconinc's case. I fear that all of the guarantees around
|



A possible simpler alternative to #4968.
I think this is equivalent, in that both use a unique static variable in a member function templated on the contained type. This PR just replaces the hashed type name with a pointer to
Handler. In fact this test is already used to check for the same type inoperator=.--- END COMMIT MESSAGE ---
This is draft, because I haven't yet tested it, except for some simple examples with different compilation units. What do you think?
@paulgessinger