26 lines
461 B
C++
26 lines
461 B
C++
#include <iostream>
|
|
#include <set>
|
|
#include <algorithm>
|
|
|
|
using namespace std;
|
|
|
|
class PrintGt5Adapter : public binary_function<int, int, void>
|
|
{
|
|
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<int> s(m, m + sizeof(m) / sizeof(m[0]));
|
|
|
|
for_each(s.begin(), s.end(), bind2nd(PrintGt5Adapter(), 2));
|
|
|
|
return 0;
|
|
}
|