#include <iostream> #include <vector> #include <boost/lambda/lambda.hpp> #include <boost/foreach.hpp> #include <pstade/oven.hpp> using namespace std; using namespace boost::lambda; using namespace pstade::oven; #define foreach BOOST_FOREACH int main() { vector<int> v; v.push_back(1); v.push_back(2); v.push_back(3); v.push_back(4); v.push_back(5); foreach (int item, v|filtered(_1 % 2 == 0)) { // 偶数のみ抽出 cout << item << endl; } // 2, 4 return 0; }