This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [patch] Preprocessorised tr1::tuple
Benjamin Kosnik wrote:
Please, please, let's resist the temptation. Ideally, we should reduce the
number of macro usage close to zero.
Yes, of course. I was just playing devil's advocate here. I think, from
looking at the code for tuple and tr1::function that additional template
magic is going to have to be invented to get to this goal. Our choices
now are to either repeat a lot of boilerplate template code or
completely abuse the pre-processor. There's got to be something better,
long term.
That's all.
One thing I will say, there is another way to implement these things (at
least most of tuple), where tuple<A,B,C,D,..Z> is transformed into
something like:
pair<A,pair<B,pair<C,...pair<Z,Null>...>
and then functions are defined to recurse their way through this
structure. This is (for example) how much of boost (including
boost::tuple) is currently implemented.
The main problems with this are a) compile times can be bad, and unless
you get some serious inlining going on performance can be REALLY bad,
and b) debugging / error messages can be a bit painful. It is another
possibilty however... I'm not sure how any template meta-programming is
going to get much better than this kind of idea..
Chris