
9 Feb
2007
9 Feb
'07
11:01 a.m.
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@tin.it