URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Subversion Repositories openrisc
[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [testsuite/] [g++.dg/] [cpp0x/] [lambda/] [lambda-std-function.C] - Rev 826
Compare with Previous | Blame | View Log
// Test using std::function wrapper.
// { dg-do run }
// { dg-options -std=c++0x }
#include <functional>
typedef std::function<int()> FN;
template<typename T>
FN f(T fn)
{
return [fn]{return fn(2);};
}
int main()
{
auto fn = f([](int i){return i*21;});
if (fn() != 42)
return 1;
return 0;
}