A
Allerdyce.John
Hi,
I have a function with add elements of a STL list from 'start' to
'end'.
In the debugger, the size of the list is 2 and start is 0 and end is 1.
But it never goes itside 'do_add' and it just return 0. I expect it
just 'sum' the FIRST element (since start is 0 and end is 1).
Can you please tell me why is that?
_myList is a type of vector<int>
float getTotal(int start,int end) {
vector<int>::iterator beginItr = _myList.begin() + start;
vector<int>::iterator endItr = _myList.begin() + end;
return accumulate (beginItr, endItr, 0.0, do_add<int, float>());
}
I have a function with add elements of a STL list from 'start' to
'end'.
In the debugger, the size of the list is 2 and start is 0 and end is 1.
But it never goes itside 'do_add' and it just return 0. I expect it
just 'sum' the FIRST element (since start is 0 and end is 1).
Can you please tell me why is that?
_myList is a type of vector<int>
float getTotal(int start,int end) {
vector<int>::iterator beginItr = _myList.begin() + start;
vector<int>::iterator endItr = _myList.begin() + end;
return accumulate (beginItr, endItr, 0.0, do_add<int, float>());
}