I get the following error message: "'void Calc(It,It,std:
air<_Ty1,_Ty2> &)' : could not deduce template argument for 'T'"
But as I am new to templates I don't know how to fix it.
Header File
But as I am new to templates I don't know how to fix it.
Code:
void doSomething()
{
for(j = start; j < start + stride; j++)
{
stopsVec.push_back( allVec[j] );
}
Calc(stopsVec.begin(), stopsVec.end(), &out);
}
Header File
Code:
template<class It, class T>
// iterator and value_type of *It
void Calc(It begin, It end, std::pair<int, int> &out)
{
std::vector<It>::iterator iter;
std::map<int, int> StartMap;
std::map<int, int>::reverse_iterator rit;
int sum, start, stop, count;
start = stop = 1;
count = sum = 0;
for(iter = begin; iter != end; iter++ )
{
sum += iter;
count++;
stop++;
if(sum <= 0)
{
// store original start
StartMap.insert(start, count);
// set new start position
start = stop;
}
}
// set iterator to highest value
rit = StartMap.rbegin();
start = rit->first;
stop = start + rit->second;
out.insert(start, stop);
}