#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
// 1 より大きいか?
//bool gt_1(int x) {
// return x > 1;
//}
class gt_1 : public unary_function<int, bool>
{
public:
result_type operator() (argument_type k)
{
return (result_type)(k > 1);
}
};
int main()
{
// 初期設定
vector<int> v {4, 2, 1, 0, 1};
cout << "v :";
for (auto x : v)
cout << " " << x;
cout << endl;
// all_of,any_of,none_of
cout << boolalpha;
bool bl = all_of(v.begin(), v.end(), gt_1()); // 単項関数オブジェクト
// bool bl = all_of(v.begin(), v.end(), gt_1); // 関数
// bool bl = all_of(v.begin(), v.end(), [](int x) { return x > 1; }); // ラムダ式
cout << " 全ての要素が 1 より大きい : " << bl << endl;
bl = any_of(v.begin(), v.end(), [](int x) { return x > 1; });
cout << " いずれかの要素が 1 より大きい : " << bl << endl;
bl = none_of(v.begin(), v.end(), [](int x) { return x > 5; });
cout << " 全ての要素が 4 以下である : " << bl << endl;
return 0;
}