DEV Community

Discussion on: Fixing C++ by making unions better

Collapse
 
pgradot profile image
Pierre Gradot

Say hello to std::variant : en.cppreference.com/w/cpp/utility/...

Collapse
 
pauljlucas profile image
Paul J. Lucas

I came here to post the same thing. It's generally a good idea to see what new things newer versions of C++ have added before you go off an re-invent the wheel.

Collapse
 
jackdelahunt profile image
Jack Delahunt

Hi, I am aware of std::variant and its even what is currently being used for code generation until I add my own implmentation.

However noticing similar features in this language to what cpp already has is not reinventing the wheel. While yes std::variant is a thing good luck using a custom allocator for the c++ stdlib. What about how impossible it is to actually debug c++ stblib types?

C++ has some nice things but no amount of feature creap until C++4X will fix some problems I have with it.