Hi there, I'm trying to multiply a factor to my probabilities by using
the std::transform algorithm. But it results in a compiler error.
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include <algorithm>
#include <iostream>
#include <fstream>
#include <vector>
struct point
{
double _prob;
double _x;
};
int _tmain(int argc, _TCHAR* argv[])
{
using namespace std;
using namespace boost::phoenix;
using namespace boost::phoenix::arg_names;
vector< int > ints;
// works
std::transform( ints.begin()
, ints.end()
, ints.begin()
, arg1 + 1
);
vector< point > points;
// doesn't work
std::transform( points.begin()
, points.end()
, points.begin()
, bind( &point::_prob, arg1 ) * val( 2.0 )
);
return 0;
}
The error is:
error C2679: binary '=' : no operator found which takes a right-hand
operand of type 'double' (or there is no acceptable conversion)
Regards,
Christian