#include #include #include using namespace std; class PrintGt5Adapter : public binary_function { public: void operator()(const int &n1, const int &n2) const { if (n1 > n2) cout << n1 << " "; } }; int main() { int m[] = {1, 2, 3, 4, 8, 5, 1, 2}; set s(m, m + sizeof(m) / sizeof(m[0])); for_each(s.begin(), s.end(), bind2nd(PrintGt5Adapter(), 2)); return 0; }