Boost logo

Boost :

From: John Max Skaller (skaller_at_[hidden])
Date: 2001-06-19 21:38:54


Gary Powell wrote:

> [Gary]
> I see what you mean, I'll talk to Jaakko, but for the first release I'd
> rather not add another 10.

        Thats fine. The limit can always be extended later without
breaking anything.

But maybe Jaakko won't mind.
 

[pointer to tuple member]

> [Gary]
> Well I don't think you can get what you want here. (Maybe Jaakko will answer
> this better.)

        I better! :-)

        You have to be able to do all the things with a tuple
you can do with a struct. The syntax doesn't have to be the same.
Both tuples and structs are isomorphic constructions known
as products, the main difference is that tuple components
are numbered not named. [Although tuples are often
immutable, the proposal here is for mutable ones]

> And thus,
>
> &tuple::cons<int, cons<float, nil> >::head.tail.head
>
> is the pointer to the member you wanted. But ugh!

        So provide a template that returns that.
 
> I'm a bit confused as to the why this sort of access is necessary.

        Suppose I have a vector of pairs. I want to traverse all
the elements and return the SECOND value of the pair when I
dereference the iterator.

        There is an iterator adaptor in the standard library for this
I think. It should work for tuples too.

-- 
John (Max) Skaller, mailto:skaller_at_[hidden]
10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850
checkout Vyper http://Vyper.sourceforge.net
download Interscript http://Interscript.sourceforge.net

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk