2013-04-10 21:29:02 -07:00
|
|
|
#include <iostream>
|
2015-02-20 00:35:01 -05:00
|
|
|
#include <math.h>
|
2013-04-10 21:29:02 -07:00
|
|
|
|
2015-02-20 00:35:01 -05:00
|
|
|
template <class F, class G>
|
|
|
|
|
decltype(auto) compose(F&& f, G&& g)
|
|
|
|
|
{
|
|
|
|
|
return [=](auto x) { return f(g(x)); };
|
|
|
|
|
}
|
2013-04-10 21:29:02 -07:00
|
|
|
|
2015-02-20 00:35:01 -05:00
|
|
|
int main() {
|
|
|
|
|
std::cout << compose(sin, asin)(0.5) << "\n";
|
2013-04-10 21:29:02 -07:00
|
|
|
return 0;
|
|
|
|
|
}
|