|
Boost Users : |
Subject: [Boost-users] variant within a recursive_variant?
From: Matthew L. Creech (mlcreech_at_[hidden])
Date: 2009-06-27 18:49:11
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 <boost/variant.hpp>
typedef boost::variant<
double,
std::string
> a_t;
struct b_t { };
typedef boost::make_recursive_variant<
a_t,
b_t,
std::vector<boost::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
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