Boost logo

Boost :

Subject: Re: [boost] [phoenix] comma woes
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2011-03-26 19:33:39


AMDG

On 03/26/2011 04:26 PM, Michael Caisse wrote:
> Unfortunately this is a common problem (statement.h). I agree that the
> silent built-in should be changed.
>
> I have had problems with std::endl and phoenix in the past... this
> version compiles fine:

It doesn't compile with VS 2010.

> -----------------
>
> #include <boost/phoenix/phoenix.hpp>
> #include <boost/phoenix/statement.hpp>
> #include <iostream>
> #include <vector>
> #include <algorithm>
>
> int main() {
> double sum = 0.0;
> int factor = 10;
>
> using namespace boost::phoenix;
> using namespace boost::phoenix::placeholders;
>
> std::vector<double> v(3);
> v[0] = 1.0; v[1] = 2.0; v[2] = 3.0;
> std::for_each(v.begin(), v.end(), (
> ref(sum) += factor * _1,
> std::cout << "Summed: " << ref(sum) << "\n" )
> );
> return 0;
> }
>
>

In Christ,
Steven Watanabe


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk