r/cpp • u/_VZ_ wx | soci | swig • Jun 17 '15
Standardizing Variant: Difficult Decisions
https://www.justsoftwaresolutions.co.uk/cplusplus/standardizing-variant.html
32
Upvotes
r/cpp • u/_VZ_ wx | soci | swig • Jun 17 '15
View all comments
Show parent comment
5
u/eric_niebler Jun 17 '15
Do you feel the same about built-in
unions?I'm sure you would agree that swallowing exceptions and continuing as if nothing went wrong is a bad thing. Should we compromise the design of our vocabulary types -- complicating their use everywhere and for everyone -- to accommodate bad code? No.
There is no empty state. There are invalid
variants that can only be encountered in bad code.