|
Boost : |
From: Jaakko Jarvi (jajarvi_at_[hidden])
Date: 2002-09-26 16:49:05
> Would it be problematic to change the implementation so that cons<X,Y> is
> derived from Y? That would make all kinds of metaprogramming jobs a lot
> easier.
I considered this at some point, and it seemed kind of backwards.
The inheritance hierarchy would look like:
null_type
cons<C, null_type>
cons<B, cons<C, null_type> >
cons<A, cons<B, cons<C, null_type> > >
tuple<A, B, C>
If we forget for a while that cons lists are not really tuples, this would
correspond to:
null_type
tuple<C>
tuple<B, C>
tuple<A, B, C>
I'd much rather have:
null_type
tuple<A>
tuple<A, B>
tuple<A, B, C>
(This is how tuple types are defined in Eiffel)
Building this kind of hierarchy would mean heavier meta-computations
to get to the next layer of the nested tuple construct.
That was some rationale for the current design.
I'll give the issue another though. Could you send me an example
that shows the benefits of the implementation where where cons<H,T>
inherits from T?
Jaakko
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk