language: C++ 4.7.2 (gcc-4.7.2)
date: 943 days 5 hours ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <iostream>
#include <vector>
#include <map>
#include <functional>
#include <boost/function.hpp>
 
using namespace std;
using namespace boost;
 
int main() {
  map<string, function<bool(int, int)> > ops;
  ops["=="] = equal_to<int>();
  ops["!="] = not_equal_to<int>();
  ops[">"] = greater<int>();
  ops["<"] = less<int>();
  ops[">="] = greater_equal<int>();
  ops["<="] = less_equal<int>(); 
  
  cout << boolalpha;
  cout << ops[">"](3000, 5000) << endl;
  cout << ops["=="](2000, 2000) << endl;
}