Is it possible to declare a variable in c++ without instantiating it? I want to do something like this:
Animal a; if( happyDay() ) a( \"puppies\" ); //c
Since c++17, there is now an overhead-free way to do this: std::optional. The code in this case would be:
#include std::optional a; if(happyDay()) a.emplace("puppies"); else a.emplace("toads");