Boost logo

Boost Users :

From: JOAQUIN LOPEZ MU?Z (joaquin_at_[hidden])
Date: 2007-05-15 18:05:38


----- Mensaje original -----
De: Seweryn Habdank-Wojewódzki <shw_at_[hidden]>
Fecha: Martes, Mayo 15, 2007 11:48 pm
Asunto: Re: [Boost-users] [1.33][tuple] Problem with tuples longer
than 10 elements
Para: boost-users_at_[hidden]

> Hi
>
> > That is general limitation. The documentation says:
> >
> > "The current version supports tuples with 0-10 elements."
>
> OK. I did not find that.

If you don't mind using a more cumbersome notation, cons lists
can be used to circumvent this limitation:

http://boost.org/libs/tuple/doc/tuple_advanced_interface.html

For instance:

  #include <boost/tuple/tuple.hpp>

  struct T0{};
  struct T1{};
  struct T2{};
  struct T3{};
  struct T4{};
  struct T5{};
  struct T6{};
  struct T7{};
  struct T8{};
  struct T9{};
  struct T10{};
  struct T11{};
  struct T12{};
  struct T13{};
  struct T14{};
  struct T15{};

  typedef
   boost::tuples::cons<T0,
   boost::tuples::cons<T1,
   boost::tuples::cons<T2,
   boost::tuples::cons<T3,
   boost::tuples::cons<T4,
   boost::tuples::cons<T5,
   boost::tuples::cons<T6,
   boost::tuples::cons<T7,
   boost::tuples::cons<T8,
   boost::tuples::cons<T9,
   boost::tuples::cons<T10,
   boost::tuples::cons<T11,
   boost::tuples::cons<T12,
   boost::tuples::cons<T13,
   boost::tuples::cons<T14,
   boost::tuples::cons<T15,boost::tuples::null_type
> > > > > > > > > > > > > > > > long_tuple;

  int main()
  {
    long_tuple lt;
    T10 t10=lt.get<10>();
  }

HTH,

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


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