Simplifing tuples

chris jefferson caj@cs.york.ac.uk
Sun Oct 10 18:00:00 GMT 2004


Paolo Carlini wrote:

> chris wrote:
>
>> I'm currently working my way through implementing this, writing a 
>> sizeable test suite, etc. I just wondered if anyone had any positive 
>> / negative comments on this kind of unfolding?
>
>
> Something I'm wondering about is whether we can provide to the user a 
> *simple* way to *set* (at library build time) the maximum number of 
> elements in one tuple type, not just 10, as mandated by the standard, 
> or an arbitrary number decided by the implementors: AFAICS this is not 
> possible neither with boost reference implementation, neither with 
> your proposal. Of course, it's something highly not trivial, 
> preprocessor magic and/or sophisticated template metaprogramming 
> techniques would be needed, but eventually the QoI would be much 
> higher, IMHO...
> .

Actually, with my current iml[ementation this owuld be possible, as I 
have a  c++ program (although this could easily be converted to C) which 
generates the tuple header takes a parameter which defines the maximum 
size of tuple. I'm curerntly testing with this parameter set to 3 so 
it's easier to see whats going on and debug. I suspect it could be done 
with preprocessor and templateness, but it wouldn't be very pretty :) 
And like all processor magic it would still require some kind of 
hard-wired maximum.

I'm still torn on wether I should generate the header with C or with 
template metaprogramming. Having discussed it with a few people, the 
arguments fall into one of two categories:
1) Why write a C program to output the header when you could do it with 
templates?
2) Why write complex templates to generate the tuples when you could 
just write a simple C program to output the header?
:)

Chris



More information about the Libstdc++ mailing list