C++11 lambdas

Rémi Forax forax at univ-mlv.fr
Mon Mar 15 04:01:45 PDT 2010


Le 15/03/2010 08:18, Stefan Schulz a écrit :
> Am 14.03.2010 22:00, schrieb Rémi Forax:
>    
>> Perhaps I'm wrong but the context after "call()"
>> seem sufficient to disambiguate.
>>
>> call() a; // a declaration
>> call();    // a method call
>>      
> You are right, I was thinking out of context... I just find it to be not
> very visible (which might be fine, though).
>
> Object() (a); // an expression lambda
> Object() a;   // a function type declaration
> Object() {Object a = create(); return a;}; // a block lambda
> new Object() {Object a = create();};       // an anonymous class
>
> Stefan
>    

Stefan,
like 3; is not a valid instruction in Java,
Object() (a); and Object() {Object a = create(); return a;};
should not compile because they are expression without side effect.

Rémi







More information about the lambda-dev mailing list