How do I iterate over a tuple
- by Caligo
How can I iterate over a tuple starting from, say, index 1 to 2? The following doesn't work.
using boost::fusion::cons;
typedef cons<A, cons<B, cons<C, cons<D> > > > MyTuple;
MyTuple tuple_;
template <class T>
struct DoSomething{
DoSomething(T& t) : t_(&t){ }
template <class U>
void operator()(U u){
boost::fusion::at<mpl::int_<u> >(*t_);
}
T* t_;
};
boost::mpl::for_each< boost::mpl::range_c<int, 1, 3> >( DoSomething<MyTuple>(tuple_) );