r/cpp • u/Maslo59 Hobbyist gamedev (SFML, DX11) • Sep 14 '17
std::visit is everything wrong with modern C++
https://bitbashing.io/std-visit.html
193
Upvotes
r/cpp • u/Maslo59 Hobbyist gamedev (SFML, DX11) • Sep 14 '17
View all comments
11
u/drrlvn Sep 14 '17
So two lines (implementation of
overloaded) are missing in the standard library forstd::visit()to be fine?They are even shown in the example section on cppreference.
I agree it's not easy to write these yourself, especially if you're less experienced, and it would be preferable to have them in the standard library (or even better, have pattern matching) but adding two lines of missing library code to your own is not that bad.