Boost logo

Boost Users :

From: pavel b (paulus1323_at_[hidden])
Date: 2019-10-29 00:35:02


Hi,

No, you should not be changing the limits and doing so will not actually
> change anything. If you want more than 64 tuple elements you could have
> a tuple whose elements themselves are tuples. For instance if you wanted
> 256 tuple elements you could program this as a tuple with 64 elements
> and each of those elements is a tuple with 4 elements. Or if you like a
> tuple with 16 elements and each of those elements a tuple of 16
> elements. You get the idea.
>

Thank you, good Idea! But in my case it was about the support of an old
project, therefore a redesign was not my first choice.

Unfortunately, there is only little room for improvement. Microsoft C++
compiler, for example, supports only 127 macro arguments.

After extending BOOST_PP_VARIADIC_SIZE and BOOST_PP_VARIADIC_SIZE_I in
boost/preprocessor/variadic/size.hpp and defining additional
BOOST_PP_VARIADIC_ELEM_[64..125] as in preprocessor/tuple/elem.hpp
BOOST_PP_TUPLE_SIZE() and BOOST_PP_TUPLE_ELEM() work with up to 126
elemnets.

BOOST_PP_TUPLE_TO_SEQ() uses internal some additional macro parameters, it
supports tuples with up to 124 elemrnts after adding
BOOST_PP_TUPLE_TO_SEQ_[65..124] similar to preprocessor/tuple/to_seq.hpp

No other boost preprocessor macros were changed/tested.

So after a few simple changes, I have succeeded to extend tuple size from
64 to 124 elements. It seems to work under current MSVC, clang and gcc
versions.



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