Boost logo

Boost :

From: Larry Evans (cppljevans_at_[hidden])
Date: 2005-02-27 17:16:43


After creating:

       typedef range_c<int,0,3> types;
       typedef fold
       < types
       , empty_base
       , inherit< arg<2>, arg<1> >
>::type tuple_type;

I'd like to use for_each on tuple_type. For example:

struct print_integral_c
{
     template<int i, typename Right>
     void operator()(inherit<integral_c<int,i>, Right>)const
     {
         std::cout<<i<<"\n";
     }
};

for_each<tuple_type>(print_integral_c);

However, tuple_type is not a sequence; hence, for_each won't work.
I could define the necessary specializations for mpl::begin, etc.,
to make it a sequence, but I was wondering if there's any way
or any plans to somehow automagically make fold or reverse_fold
into a sequence so I could use for_each on it.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk