#include #include #include #include namespace fusion = boost::fusion; template struct inc_array_size; template struct inc_array_size, T2> { typedef boost::array type; }; struct seq_to_array { template struct result; template struct result : inc_array_size {}; template struct result : inc_array_size< typename boost::remove_const::type , typename boost::remove_const::type > {}; template typename inc_array_size::type operator()(State const& s, T const & t) const { typename inc_array_size::type res; this->assign(res, s, t, 0); return res; } private: template void assign(boost::array & res, State const & old, T const & t, int counter) const { if(counter == N) return; res[counter] = old[counter]; this->assign(res, old, t, ++counter); } }; int main() { boost::array boostarr={{1.0, 2.1, 3.2}}; fusion::vector fusionvec(boostarr); boost::array boostarr2 = fusion::fold(fusionvec, boost::array(), seq_to_array()); }