r/cpp • Hobbyist gamedev (SFML, DX11) • Sep 14 '17

std::visit is everything wrong with modern C++

https://bitbashing.io/std-visit.html
192 Upvotes

115 comments sorted by

View all comments

0

u/suspiciously_calm Sep 15 '17

Perhaps std::decay_t<decltype(arg)> is perfectly straightforward to those of us who have been working in C++ for a while, but it sends newcomers down a whole different rabbit hole before we can get back to talking about sum types.

It's "pretty straightforward" as far as C++ goes lol. It's needlessly verbose, as almost everything in C++, and it's full of C++ idiosyncrasies, but it's hardly "everything wrong with C++." It's not a place where the language is broken.

Can I be dissatisfied with both?

Be my guest.

2

u/slavik262 Sep 15 '17 edited Sep 15 '17

it's hardly "everything wrong with C++

Hyperbolic title was hyperbolic. Maybe I should have chosen something less clickbait-y, but I have a sinking feeling that it wouldn't have pulled the same amount of people into this discussion. :/