No more than 10 types in boost::tuple?
I tried constructing a tuple with 12 types today without much luck. I've read through the headers to see if there was any obvious way of getting around the 10 limit but couldn't find one (I half expected to find something along the way of vectorxx<>, in MPL). Am I being stupid, or is there really no way of constructing a tuple with more than 10 elements? Also, are there any plans of integrating and/or making boost::tuple dependant on the MPL? I realize that tuple predates the MPL, but there's no use in duplicating efforts. boost::tuple has it's own compile time IF<> and also provides it's own typelist class which are both readily available in the MPL. Cheers, -- Tarjei
On Fri, 2003-05-30 at 14:08, Tarjei Knapstad wrote:
I tried constructing a tuple with 12 types today without much luck. I've read through the headers to see if there was any obvious way of getting around the 10 limit but couldn't find one (I half expected to find something along the way of vectorxx<>, in MPL).
Am I being stupid, or is there really no way of constructing a tuple with more than 10 elements?
It just occured to me that I can make the 10th template argument of
tuple a "cons" list in itself, but I find this a bit awkward, i.e.
typedef cons
The current Boost::tuple implementation is limited to 10 arguments. As you pointed out, one can use cons lists directly to circumvent this limitation. Tuples are now part of the C++ standard techical report, meaning that they are likely to be part of the next standard library revision. The interface of the std::tr1::tuples do not include the cons list part, as there are other viable implementation options for tuples. We have written (together with Joel Guzmann) a preprocessor based implementations of tuples, which will allow up to 50 (I think, or even more) element tuples. That implementation will find its way to boost in some schedule, hopefully to the next release. It'll likely coexist with the current implementation, at least for some time to come. Cheers, Jaakko -- -- Jaakko Järvi email: jajarvi@cs.indiana.edu -- Post Doctoral Fellow phone: +1 (812) 855-3608 -- Pervasive Technology Labs fax: +1 (812) 855-4829 -- Indiana University, Bloomington On Fri, 30 May 2003, Tarjei Knapstad wrote:
On Fri, 2003-05-30 at 14:08, Tarjei Knapstad wrote:
I tried constructing a tuple with 12 types today without much luck. I've read through the headers to see if there was any obvious way of getting around the 10 limit but couldn't find one (I half expected to find something along the way of vectorxx<>, in MPL).
Am I being stupid, or is there really no way of constructing a tuple with more than 10 elements?
It just occured to me that I can make the 10th template argument of tuple a "cons" list in itself, but I find this a bit awkward, i.e.
typedef cons
> > some_types; typedef tuple large_tuple; Should tuple by default allow for more than 10 types? Or at least provide macros ala Alexandrescu's typelist construction macros?
Cheers, -- Tarjei
Yahoo! Groups Sponsor [yhoo0303_b_300250a.gif] [rand=355203899] Info: http://www.boost.org Wiki: http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl Unsubscribe: mailto:boost-users-unsubscribe@yahoogroups.com
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
On Fri, 2003-05-30 at 20:41, Jaakko Jarvi wrote:
The current Boost::tuple implementation is limited to 10 arguments. As you pointed out, one can use cons lists directly to circumvent this limitation.
I've tried this now, and I couldn't get it quite right. Defining the
tuple is no problem of course, but it still only becomes a tuple of 10
types where the last type is a cons list, so get<> etc. fails. The cons
list doesn't fall in smoothly as I originally thought, but a
cons Tuples are now part of the C++ standard techical report,
meaning that they are likely to be part of the next standard library
revision. The interface of the std::tr1::tuples do not include
the cons list part, as there are other viable implementation options for
tuples. We have written (together with Joel Guzmann) a preprocessor based
implementations of tuples, which will allow up to 50 (I think, or even
more) element tuples. That implementation will find its way to boost in
some schedule, hopefully to the next release. It'll likely coexist with
the current implementation, at least for some time to come. I'll be waiting :) On Fri, 2003-05-30 at 14:08, Tarjei Knapstad wrote: I tried constructing a tuple with 12 types today without much luck.
I've
read through the headers to see if there was any obvious way of
getting
around the 10 limit but couldn't find one (I half expected to find
something along the way of vectorxx<>, in MPL). Am I being stupid, or is there really no way of constructing a tuple
with more than 10 elements? It just occured to me that I can make the 10th template argument of
tuple a "cons" list in itself, but I find this a bit awkward, i.e. typedef cons Should tuple by default allow for more than 10 types? Or at least
provide macros ala Alexandrescu's typelist construction macros? Thanks,
--
Tarjei
participants (2)
-
Jaakko Jarvi
-
Tarjei Knapstad