fork(1) download
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <functional>
  4.  
  5. int main()
  6. {
  7. bool foo = true;
  8. auto predicate = foo ? std::function<bool(int,int)>(std::greater<int>()) : std::function<bool(int,int)>(std::greater_equal<int>());
  9. auto b = std::bind2nd(predicate, 2);
  10. std::cout << b(4) << std::endl; // true, 4 > 2
  11. }
  12.  
Success #stdin #stdout 0.01s 3476KB
stdin
Standard input is empty
stdout
1