|
Boost Users : |
From: Joaquín Mª López Muñoz (joaquin_at_[hidden])
Date: 2006-05-29 11:41:01
Adrián Etchevarne ha escrito:
> Problem:
> How can I get a tuple type from a tuples::cons<> list ?
> example:
> given the type:
> cons<int, cons<float, cons<int, null_type> > >
>
> obtain
> tuple<int, float, int>
>
> Real problem:
> I need to insert a type T at the beginning of a tuple, how I can do this?
>
> example
> given the type T and tuple<int, float>, obtain a tuple<T, int, float>
>
> Thanks in advance,
> Adrián
Hi Adrián, I think you've got to resort to brute force, although
Boost.PP helps a lot with this kind of tasks. Please find attached
a possible implementation of a tuple_from_cons helper metafunction,
though I'm sure the PP experts out there could come out with simpler
and nicer formulations.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
___________________________________________________________________________
Antes de imprimir este mensaje, asegúrese de que es necesario.
La mejora del medio ambiente empieza en nuestro día a día.
___________________________________________________________________________
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