[Fusion] is mpl::insert supported for fusion::vector?

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

Christian Holmquist wrote:
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>
changing this to #include <boost/fusion/include/mpl.hpp> brings in some missing stuff to make mpl::begin< fusion::vector<> >::type work
typedef typename mpl::insert<Sequence, itr, T>::type type; };
AFAICT insert<> is supposed to work on extensible associative sequences, maybe a mpl::vector has been extended to support that concept, but a fusion vector might not be. HtH, Cheers, Rutger
participants (2)
-
Christian Holmquist
-
Rutger ter Borg