Boost logo

Boost Users :

Subject: [Boost-users] mpl: copy algorithm question
From: Hicham Mouline (hicham_at_[hidden])
Date: 2010-05-16 07:02:42


Hello,

I need to copy a range_c into a vector_c because I need to transform that
sequence, and I have difficulties transforming range_c .

This code works
  typedef boost::mpl::range_c<std::size_t, 2u, 10> range_t;
  typedef boost::mpl::vector_c<std::size_t> all_dims1_t;
  typedef boost::mpl::copy< range_t, boost::mpl::back_inserter<all_dims1_t>
>::type all_dims_t;

but then I need the 10 to be a template parameter, so I wrap it in this
struct

template <std::size_t max_dim>
struct S {
  typedef boost::mpl::range_c<std::size_t, 2u, max_dim> range_t;
  typedef boost::mpl::vector_c<std::size_t> all_dims1_t;
  typedef boost::mpl::copy< range_t, boost::mpl::back_inserter<all_dims1_t>
>::type all_dims_t;
};

The error is:
error: type 'boost::mpl::copy<...>' is not derived from type 'S<max_dim>'

Really strange?

Regards,


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