allはすべてがtrueならtrueを、そうでなければfalseを返します。
anyはどれか一つがtrueならtrueを、そうでなければtrueを返します。
bool all(shared_ptr<cIterable<bool>> g) { while(g->exists_next()) { if(!g->value()) return false; } return true; } bool any(shared_ptr<cIterable<bool>> g) { while(g->exists_next()) { if(g->value()) return true; } return false; } int main() { cout << all(map([] (int n) { return n < 5; }, range(5))) << endl; cout << any(map([] (int n) { return n < 1; }, range(5))) << endl; }
どちらもtrueを返します。