|
Boost Users : |
Subject: Re: [Boost-users] [tuple][mpl][fusion] How to "prune" or "collapse" a tuple?
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2010-08-13 17:09:58
AMDG
AJG wrote:
> // Collapse code:
>
> template <typename Sequence>
> struct tuple_from_sequence :
> mpl::reverse_fold
> < Sequence
> , tuples::null_type
> , tuples::cons<mpl::_2, mpl::_1>
> > {};
>
> template <typename T0, typename T1, typename T2, typename T3, typename T4,
> typename T5, typename T6, typename T7, typename T8, typename T9>
> struct collapse <tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> > {
> typedef tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> original;
> typedef mpl::list<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> sequence;
>
> typedef typename mpl::remove<sequence, tuples::null_type>::type removed;
> typedef typename tuple_from_sequence<removed>::type type;
>
> static type construct(original const& t) {
> // return ???;
> }
> };
>
Try using fusion::remove
http://www.boost.org/libs/fusion/doc/html/fusion/algorithm/transformation/functions/remove.html
In Christ,
Steven Watanabe
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