fork download
  1. #include <iostream>
  2.  
  3. template<class T, class F>
  4. bool foo(T&& a, T&& b, F&& f)
  5. {
  6. return f(a, b);
  7. }
  8.  
  9. bool cmp(int a, int b)
  10. {
  11. return a == b;
  12. }
  13.  
  14. int main()
  15. {
  16. std:: cout << std::boolalpha << "3 == 5 --> " << foo(3, 5, cmp) << std::endl;
  17.  
  18. }
Success #stdin #stdout 0s 2884KB
stdin
Standard input is empty
stdout
3 == 5 --> false