
Ok, my bad. What would be your solution? For instance, I changed over to std::for_each but still need a separate function to do the actual multiplication plus assignment. struct point { double _prob; double _x; }; void mul_assign( double& l, const double& f ) { l *= f; } int _tmain(int argc, _TCHAR* argv[]) { using namespace std; using namespace boost::phoenix; using namespace boost::phoenix::arg_names; vector< point > points( 1 ); std::for_each( points.begin() , points.end() , bind( &mul_assign, bind( &point::_prob, arg1 ), 2.0 ) ); return 0; } Is there a way I could get rid off "mul_assign"? Thanks, Christian On Fri, Nov 7, 2008 at 4:19 PM, Steven Watanabe <watanabesj@gmail.com> wrote:
AMDG
Christian Henning wrote:
vector< point > points;
// doesn't work std::transform( points.begin() , points.end() , points.begin() , bind( &point::_prob, arg1 ) * val( 2.0 ) );
Certainly, it won't work. You're code does the equivalent of:
points[i] = points[i]._prob * 2.0
In Christ, Steven Watanabe
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users