fork download
  1. #include <iostream>
  2. #include <vector>
  3. #include <boost/function.hpp>
  4.  
  5. template <class T>
  6. T g(boost::function<T(T)> f, T a, T b)
  7. {
  8. std::cout << f(a) << " " << f(b) << '\n';
  9. }
  10.  
  11. double f(double x) { return 1+x; }
  12.  
  13. int main()
  14. {
  15. g<double>(f, 1.1, 2.2);
  16. }
  17.  
Success #stdin #stdout 0.02s 2728KB
stdin
Standard input is empty
stdout
2.1 3.2