0

I have the following C++ code:

template<typename T>
T processVector(const std::vector<T>& input){

    for(std::vector<T>::const_iterator it=input.begin();it!=input.end();it++){

            //process vector
    }

}

However, I get the following error upon compilation:

listOfVectors.cpp:6: error: expected `;' before ‘it’
listOfVectors.cpp:6: error: ‘it’ was not declared in this scope

I have been pondering over it for quite a while but can't make out why I am getting this error. I also tried clang to see if I can make anything out of its error statement but couldn't. Would appreciate the help. Thanks

user2105632
  • 751
  • 1
  • 7
  • 12
  • 2
    That's [not the most useful](http://coliru.stacked-crooked.com/a/7fb84944f74162f3) compiler error I've seen. – chris Jul 11 '14 at 00:17
  • @chris Looks like [g++](http://coliru.stacked-crooked.com/a/2c94ee019596f234)'s error message, but somehow he missed the first line. – T.C. Jul 11 '14 at 01:45

0 Answers0