Boost logo

Boost Users :

Subject: [Boost-users] Variant bool bug
From: Robin (robin_at_[hidden])
Date: 2010-05-21 05:27:52


Hi

When I add a bool into the variant, the get int version fails (VC2008 SP1, boost
1.37)

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

       VariantType variant;
        variant = "hello world";
        string stringTest = boost::get <string> (variant);
        cout << stringTest.c_str () << endl;

        variant = 5;
        int intTest = boost::get <int> (variant); // Fails
        cout << intTest << endl;

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