Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Yuan_Tang
Beginner
78 Views

function objects to capture lambda functions in C++

Hi,

as you know, lambda function in C++ could be captured by 2 options:

1) auto keyword

2) function object such as following:
#include 
using namespace std; function f2 = [] (int x, int y) { return x + y; };
But when I compile this code with icc-12(beta), it will complain:

tb_pochoir.hpp(62): error: function is not a template
function f2;
^
Would you tell me why? and how to fix this problem?

Thanks!

-Yuan

0 Kudos
5 Replies
Brandon_H_Intel
Employee
78 Views

Which version of Visual Studio* are you using? The problem might be in the Microsoft STL support. This works for me with the Intel compiler integrated with Visual Studio 2010*.
Yuan_Tang
Beginner
78 Views

Brandon,

I'm using icc-12 (beta) version under linux. So, there's no visual studio. Just icc.

Would you give me some idea how to fix this problem?

Thanks!

-(\x.x x) (\x.x x)
Brandon_H_Intel
Employee
78 Views

Hi Yuan,

We don't support variadic templates yet in the compiler. I've linked this thread to an open request for that support, and when I have any more news, I will update this thread. Unfortunately, there's no workarounds at this point to get this to work without that support.
Brandon_H_Intel
Employee
78 Views

Brandon_H_Intel
Employee
78 Views

This problem is resolved in the version 12.1 compiler available in Intel C++ Composer XE 2011 update 6 and above.
Reply