Hi,
I'm wondering if anyone has successfully embedded a boost::variant<>
within a recursive variant. The program below illustrates what I'm
trying to do:
=============
#include <vector>
#include <string>
#include
typedef boost::variant<
double,
std::string
> a_t;
struct b_t { };
typedef boost::make_recursive_variant<
a_t,
b_t,
std::vectorboost::recursive_variant_
>::type c_t;
int main()
{
a_t a(20.0);
c_t c(a);
return 0;
}
=============
With GCC, this gives me:
...
boost/variant/variant.hpp:1269: error: no matching function for call
to 'boost::detail::variant::initializer_root::initialize(void*,
double&)'
Normal variant-within-a-variant works fine (i.e. if I remove the
vector, and just declare c_t without make_recursive_variant<>). And
make_recursive_variant<> with plain types works as well (i.e. if a_t
is a non-variant type). But I can't figure out how to make the two
work together...
Any help would be greatly appreciated. Thanks!
--
Matthew L. Creech