No. The point of boost :: variant is that it has a fixed size and does not perform dynamic allocation. So he looks like a union. The recursive boost :: variant must have infinite size in order to contain its largest possible value - obviously impossible.
You could, however, do this by passing it through a pointer. For instance:
struct nil { };
typedef boost::make_recursive_variant<nil,
std::pair<int, boost::scoped_ptr<boost::recursive_variant_> > >
variant_list_int;
source
share