2011-04-04から1日間の記事一覧

Boost.Phoenix V3 - 2つ以上の式を書く

C++

カンマ演算子で、複数の式が書けます。 #include <vector> #include <boost/range/algorithm/for_each.hpp> #include <boost/phoenix.hpp> int main() { using boost::phoenix::arg_names::_1; namespace phx = boost::phoenix; const std::vector<int> v = {1, 2, 3}; int sum = 0; boost::for_each(v, ( phx::ref(sum) += _1, st</int></boost/phoenix.hpp></boost/range/algorithm/for_each.hpp></vector>…