I have defined a boost::variant var like this:
boost::variant<boost::blank, bool, int> foo;
This variable, when instantiated but not initialized, has a value of type boost::blank
, because boost::blank
is the first type passed to the templated boost::variant.
At some point, I want to know if foo
has been initialized. I've tried this, but with no good results:
if (foo) //doesn't compile
if (foo != boost::blank()) //doesn't compile
if (!(foo == boost::blank())) //doesn't compile
I think it's worth noticing that, when foo
has been initialized (eg., foo = true
), it can be "reset" by doing foo = boost::blank();
.
How can I check if foo
has been initialized, ie, it has a different type than boost::blank
?