Boost logo

Boost Users :

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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net