Subject: [Boost-users] Inconsistent with variant with bool
From: Robin (robin_at_[hidden])
Date: 2010-05-22 11:54:34


Hi

I'm facing a inconsistent behavior with Variant when bool is defined. The below
code will return i as 0

typedef boost::variant <int> VariantType;

VariantType variant;
int i = boost::get <int> (variant)); // default to 0

If I set a bool in the variant

typedef boost::variant <bool, int> VariantType;

VariantType variant;
int i = boost::get <int> (variant)); // this throws fail get

Is it intended behavior?

Robin