3 ms·
As I know C++ now allows multiple dispatch for std::variant: https://en.cppreference.com/w/cpp/utility/variant/visit2.html https://en.cppreference.com/w/cpp/uti
by Panzerschrek 1y ago
As I know C++ now allows multiple dispatch for std::variant: https://en.cppreference.com/w/cpp/utility/variant/visit2.html https://en.cppreference.com/w/cpp/utility/variant/visit2.htm....
And std::variant is now a better choice for cases like in the article above, where previously inheritance was used to represent a closed set of possible subtypes.
- RossBencina 1y agoWhere "now" means C++17 or C++20 depending on whether or not you understand what INVOKE<R> semantics are?
- maattdd 1y agoTIL that std::visit supports multiple variants. How new is that ?
- MathMonkeyMan 1y agoAlways did, as far as I know. Never knew why...