0

What is the reason of this error in this case?

'it' was not declared in this scope

I don't understand why I get that error, I defined it in statement of for loop..

#include <vector>
#include <iostream>
template<class T>
void LoopFunction() {
    std::vector<T> vec;
    for (std::vector<T>::iterator it = vec.begin(); it != vec.end(); it++) { // **error in this line**
        //....
    }
}
Software_t
  • 576
  • 1
  • 4
  • 13

0 Answers0