Suppose I'm tying to build a nested lambda expression, like so
(typename...::type omitted for simplicity):
lambda
Geoffrey Romer writes:
Suppose I'm tying to build a nested lambda expression, like so (typename...::type omitted for simplicity):
lambda
>, _2> > - Is this legal?
Yes, although the semantics is probably not what you are trying to achieve: for the purpose of inline metafunction composition, 'lambda' is just a metafunction without any special status, and is treated as such. The 'apply' test (http://cvs.sourceforge.net/viewcvs.py/boost/boost/libs/mpl/test/apply.cpp?rev=1.5&view=markup) actually illustrates this and similar cases well.
- Does the _1 refer to the first argument of the inner lambda, or of the outer lambda?
The outer one.
- Can the above be overridden? I.e. what if I want to refer to the arguments of both lambdas within the inner lambda?
It's not currently supported, but it's on the TODO list -- see http://thread.gmane.org/gmane.comp.lib.boost.devel/115924. -- Aleksey Gurtovoy MetaCommunications Engineering
On 10/5/05, Aleksey Gurtovoy
Geoffrey Romer writes:
Suppose I'm tying to build a nested lambda expression, like so (typename...::type omitted for simplicity):
lambda
>, _2> > ... - Does the _1 refer to the first argument of the inner lambda, or of the outer lambda? The outer one.
Is that also true if the inner lambda were a bind?
Geoffrey Romer writes:
On 10/5/05, Aleksey Gurtovoy
wrote: Geoffrey Romer writes:
Suppose I'm tying to build a nested lambda expression, like so (typename...::type omitted for simplicity):
lambda
>, _2> > ... - Does the _1 refer to the first argument of the inner lambda, or of the outer lambda? The outer one.
Is that also true if the inner lambda were a bind?
No, bind expressions are passed through 'lambda' untouched. From
http://cvs.sourceforge.net/viewcvs.py/boost/boost/libs/mpl/test/apply.cpp?rev=1.5&view=markup:
MPL_TEST_CASE()
{
typedef bind2
participants (2)
-
Aleksey Gurtovoy
-
Geoffrey Romer