Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2005-04-27 07:51:29

"Giovanni P. Deretta" <lordshoo_at_[hidden]> writes:

> Hi,
> I have been using a small extension to the tuple library 'get' function,
> that I have found very handy. It allows the extraction of an element of
> a tuple by specifying its type instead of the index.
> Example:
> given the tuple boost::tuple<type1, type2, type3>
> get<type1> returns the first element of the tuple of that type.
> This allows one to write more self describing code: you don't need to
> look up the tuple element type when you find an indexed get function
> buried deep inside some code.
> This is especially useful with nested tuples where for example
> 'get<3>(get<5>(get<0>(my_tuple)))' looks more like line noise than real
> code :).

You might look at c:/boost/boost/python/detail/tuple_extract.hpp


Dave Abrahams
Boost Consulting

Boost list run by bdawes at, gregod at, cpdaniel at, john at