Boost logo

Boost :

From: Giuseppe Ottaviano (giuott_at_[hidden])
Date: 2007-02-09 06:01:58


Hi,
I work often with containers of tuples or pairs, using stl and boost
algorithms. Accessing elements with boost lambda is a bit cumbersome,
requiring syntax like
bind(&pair<int, int>::first, _1)
I have written a small adaptor to make get<> work with lambda
expressions, so that the syntax becomes
get<0>(_1)
It works for std::pair and boost::tuple.

It is only a suggestion, i do not know if it handles correctly consts,
references, etc, and has been tested only on gcc 4.1.2. I've posted the
code on boost vault:
http://www.boost-consulting.com/vault/index.php?action=downloadfile&filename=lambda_tuple.zip&directory=&

Can something like this be implemented in future versions of Lambda?

Thanks,
Giuseppe Ottaviano
giuott_at_[hidden]


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