Boost logo

Boost Users :

From: Johannes Dahlström (sharlin_at_[hidden])
Date: 2005-03-04 14:40:39


I ran into a bizarre problem trying to build a variant from an MPL vector.
The compilation of make_variant_over seems to fail when given any vector
which a) uses all its template arguments, and b) contains *only*
user-defined types; ones with at least one built-in type work fine! The
problem occurs at least with gcc 3.3.5 and gcc 3.4.4 20050203 prerelease,
on Debian unstable/x86. The following code demonstrates the problem:

////////////////////////////////////////////////////////////////////////

#include <boost/variant.hpp>
#include <boost/mpl/vector.hpp>

#include <cstdio>

// a template for generating dummy types
template <int i> struct d { };

typedef boost::mpl::vector
< d<0>, d<1>, d<2>, d<3>, d<4>,
  d<5>, d<6>, d<7>, d<8>, d<9> > vector;

boost::make_variant_over<vector>::type v;

////////////////////////////////////////////////////////////////////////

The same thing happens with vector10 and others, but lists do seem to work
correctly, providing a work-around. Swapping any built-in type for any of
the d<>'s makes the code above to compile cleanly. I can post the complete
compiler error output if you like, but there's rather much of it :p

-Johannes


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