Boost logo

Boost Users :

Subject: [Boost-users] [Fusion] is mpl::insert supported for fusion::vector?
From: Christian Holmquist (c.holmquist_at_[hidden])
Date: 2010-03-16 03:56:41


Hi,

The following meta program compiles, except for the last (commented) line.
I expected it to work since it does so for the mpl::vector case.
Any ideas what I am doing wrong here?

#include <boost/fusion/container/vector.hpp>
#include <boost/fusion/adapted/mpl.hpp>
#include <boost/mpl/insert.hpp>
#include <boost/mpl/begin.hpp>
#include <boost/mpl/advance.hpp>
#include <boost/mpl/int.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/mpl/equal.hpp>

using namespace boost;

template<class Sequence, class Pos, class T>
struct insert_at
{
typedef typename mpl::advance<typename mpl::begin<Sequence>::type,
Pos>::type itr;
typedef typename mpl::insert<Sequence, itr, T>::type type;
};

typedef insert_at<mpl::vector<>, mpl::int_<0>, int>::type vector1_int;
BOOST_MPL_ASSERT(( mpl::equal<vector1_int, mpl::vector<int>>));

//Doesn't compile with VC2008
// typedef insert_at<fusion::vector<>, mpl::int_<0>, int>::type
fusion_vector1_int;

Code is using boost-trunk, rather recently updated.

Thanks,
Christian



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