I have a boost::variant in my program and I want to check if the variant itself is initialized and also if there is a value contained in one of it’s types.
I’ve tried empty() on the variant, but that doesn’t seem to work. Neither does checking against NULL.
Does anybody know how to check for this?
EDIT: Ok, It seems it will never be empty, but there will not always be a value in it’s contained types, so how do I check for a no-value situation?
A
boost::variantis always initialized.If you did not initalized it explicitly, the first item was constructed using its default constructor: