Boost logo

Boost Users :

Subject: [Boost-users] recursive_variant map recursion / incomplete type error
From: Bodmer Marc (Marc.Bodmer_at_[hidden])
Date: 2011-11-17 05:10:27


Hi

I try to use boost::recursive_variant with a recursive std::map.

There are several projects and examples on the internet using
boost::recursive_variant exactly like I do and it seems to work there.

But somehow I can not make it compile in my environment. I am using gcc
4.6.1 and boost 1.46.1.

I've stripped my code down to this:
-------------------------------------------------------------
#include <boost/variant.hpp>
#include <map>

typedef boost::make_recursive_variant<
    int,
    std::map<float, boost::recursive_variant_>
>::type element;

int main ()
{
    element i = 42;
}


But I always get these errors about uncomplete types (see attachments
for full compiler output and code):
-------------------------------------------------------------

/usr/include/c++/4.6/bits/stl_pair.h:93:11: error: 'std::pair<_T1,
_T2>::second' has incomplete type

/usr/include/boost/variant/variant_fwd.hpp:232:12: error: forward
declaration of 'struct boost::recursive_variant_'


used compile command:
------------------------------------------------------------
gcc recursive_variant_stripped.cpp 2> gccout.txt


Thanks for any help and suggestions
regards

Marc







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