Hello everybody,
I am trying to teach my stl and after writing some basic programs I have hit a road block. I have an iterator which I am trying to pass to a function template
Here is my function template
template <class T>
void display(typename vector<T>::iterator start, typename vector<T>::iterator end){
cout<<"My display "<<*start<<endl;
}
Here is the call to this function
vector<int>::iterator myBeginIterator;
vector<int>::iterator myEndIterator;
myBeginIterator = myVector.begin();
myEndIterator = myVector.end();
display(myBeginIterator,myEndIterator);
Howevert this code refuses to compile. The compilation error is
error: no matching function for call to ‘display(__gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int> > >&, __gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int> > >&)
I am pretty sure this is a noob mistake. I am more of a C guy as opposed to a C++ guy. Can some one take a look at the code snippet and tell me if there is an obvious bug