I’m trying to define a function
template<typename Functor> static void start(DataSize size, ThreadNum threadNum, Functor f)
{
....
std::for_each<int>(allocated, size, f);
....
}
allocated and size are just int.
The caller calls the function
start(image.width() * image.height(), _threads, RGBHistogramFun<T>(image, hist));
and
template<typename T> class RGBHistogramFun
{
...
void operator()(std::size_t i)
{
....
}
}
I set T to int for the template. I’m trying to define std::for_each so that it calls RGBHistogramFun::operator(std::size_t i) for each integer from allocated to size. The operator() will use the index to manipulate its internal array data.
However, I’m getting compiler error something about xutility.
n3337 25.2.4
intcannot bedereferenced.