22 May
2010
22 May
'10
4:03 p.m.
On 05/22/10 10:54, Robin wrote: [snip]
typedef boost::variant <bool, int> VariantType;
VariantType variant; int i = boost::get <int> (variant)); // this throws fail get
Is it intended behavior?
Robin
The default value of the variant is the 1st bound type, which in case of: variant<bool,int> is bool. Hence, when you try to retrieve an int with get<int>(variant), it throws, as expected. -Larry