First-class functions: Difference between revisions

Line 332:
 
=={{header|C++}}==
{{works with|C++11}}
This uses many C++0x niceties so make sure you put your compiler in the correct mode.
 
<lang cpp>
#include <tr1/functional>
#include <vector>
#include <iostream>
Line 343:
using std::cout;
using std::endl;
using std::tr1::function;
 
vector<double(*)(double)> A = {sin, cos, tan, [](double x) { return x*x*x; } };
Line 365:
auto identity = compose(log10, pow);
PRINT(identity(10, num));
return 0;
}
</lang>
Anonymous user