compiler gcc4.5 minGW
OS : windows xp sp3
I try something like this
template<typename T, typename U>
class fastRowSum
{
public :
fastRowSum();
typedef void result_type; //what is this line for?
template<typename inputItr, typename outputItr>
void operator() (T const VALUE, inputItr ref, outputItr out)
{
error = VALUE > *ref ? VALUE - *ref : *ref - VALUE;
errorSum += error;
std::cout<<"base = "<<VALUE<<", ref = "<<*ref<<", out = "<<*out<<"\n";
++ref; ++out;
}
private :
U error;
U errorSum;
};
template<typename T, typename U>
fastRowSum<T, U>::fastRowSum()
:error(0),
errorSum(0)
{}
//I call the functor like this
std::for_each(augBase.begin(), augBase.end(), std::tr1::bind(fastRowSum<T, U>(), std::tr1::placeholders::_1, augRef.begin(), matchingCost_Itr ) );
after the experiment, I found out that maybe bind didn't really pass the address of
augRef.begin() and matchingCost_Itr to the functor
That is why only the first value of the container would change
++ref; ++out;
didn't increment the address of the iterator
Are there anyway to solve this?Thank you very much