Boost logo

Boost :

From: Joaquín Mª López Muñoz (joaquin_at_[hidden])
Date: 2003-04-29 03:39:26


Alexander Nasonov ha escrito:

>

[stuff deleted]

>
> Alternatively, you can implement MPL conformant sequence
> tuple_sequence<Tuple>. It's not so hard as you can imagine.
> (Question to MPL's authors: when it will be documented?).
>

I know it is not hard (candidate implementation follows): it is only that I
do not want to rewrite the snippet if it happens to exist already somewhere
into the Boost jungle.

template <class Tuple,int N=0>
struct tuple_to_sequence
{
  BOOST_STATIC_CONSTANT(int,end=(N==tuples::length<Tuple>::value));

  typedef typename mpl::apply_if_c<
    end,
    mpl::identity<mpl::vector<> >,
    tuple_to_sequence<Tuple,N+1>
>::type base;

  typedef typename mpl::apply_if_c<
    end,
    mpl::identity<tuples::null_type>,
    tuples::element<N,Tuple>
>::type extra;

  typedef typename mpl::apply_if_c<
    end,
    mpl::identity<base>,
    mpl::push_front<base,extra>
>::type type;
};

Regards,

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo

>
> --
> Alexander Nasonov
> Remove minus and all between minus and at from my e-mail for timely response
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost


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