Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7944 Discussions

c++ 0x and Lambda functions extension

max-divulskiy
Beginner
773 Views
Good afternoon.

Tell me please when will be a possibility to use template lambda function in Intel compiler?
0 Kudos
6 Replies
Judith_W_Intel
Employee
773 Views
Can you point to a document on this extension please? Not sure what you're referring to...

thanks
Judy
0 Kudos
max-divulskiy
Beginner
773 Views
If it is possible to write lambda function why it is impossible to write a template lambda function?

Unfortunately it while is not present, but hands and ask to write template =)

Whether it is necessary to expect such extension in the near future?
0 Kudos
Judith_W_Intel
Employee
773 Views
One already can use template arguments from the outer function toa lambda function. Can you show
an example of what you're trying to do? Sincelambdas are not really functions, i.e. they can only becalled from oneplace(at the point of the definition) what would be the purposein makingthem templates?

Anywaythis is really a question for the C++ standards committee. Intel has implemented what's described in the C++0x standard.
0 Kudos
max-divulskiy
Beginner
773 Views
I mean something that =)

[bash]template
Type lambdaSum = [&](Type x, Type y)
{
    return x + y;
};[/bash]
0 Kudos
Judith_W_Intel
Employee
773 Views

Thisdoesn't look like a lambda since lambdas don't have names and can't be "called" like a function. This looks more like a template function that's trying to use lambda syntax for the parameter types.

Judy
0 Kudos
max-divulskiy
Beginner
773 Views
Thanks for answers.
0 Kudos
Reply