Hello meta programmers,
I am looking for a way to extract a sub sequence of a given type list by identifying the begin/end of the sub sequence by the corresponding iterators
<code>
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
// these namespace clauses are motivated from "C++ Template Metaprogramming" by D.Abrahams,A.Gurtovoy:
namespace mpl = boost::mpl ;
using mpl::placeholders;
// But why do I still need to type 'mpl::_1' instead of plain '_1' ?
// here is my type list
typedef mpl::vector my_types;
// from_pos and to_pos are start and end iterators of the subsequence
typedef typename mpl::find::type from_pos;
typedef typename mpl::find::type to_pos;
// all elements (types) of my_types should be copied into the new seuqence my_sub_types if their iterator (index) is inside the given interval (from_pos,to_pos)
typedef mpl::copy_if::type, mpl::int_ > ,
mpl::less< mpl::find::type, mpl::int_ >
,
mpl::back_inserter< mpl::vector<> >
::type my_sub_types;
</code>
This code (and lots of slight variations) does not compile. Why ?
Any hint (conceptual,syntactical,etc.) is welcome !
regards,Martin.