Boost logo

Boost Users :

Subject: [Boost-users] vector iterator element-wise operation
From: Max S. Kaznady (max.kaznady_at_[hidden])
Date: 2010-07-04 18:16:38

I'm using this example:

and for some reason the function std::fill compiles and works just
fine, but functions std::for_each and std::transform do no compile -
saying that there is no compatible function found for the iterator

using namespace boost::numeric::ublas;
// Create a 30 element vector of doubles
vector<double> vec(30);
// Assign 8.0 to each element.
std::fill(vec.begin(), vec.end(), 8.0);
// Perform the "Gamma" function on each element and assign the result back
// to the original element in the vector.
// The next line does not compile, but the fill function compiles and
executes just fine:
std::transform(vec.begin(), vec.end(), vec.begin(), boost::math::tgamma);

What's wrong?


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at