Passing vector iterator to a function c++

That the code would be compiled you have to declare an overloaded function like

void funcToCall ( std::vector<tObj>::iterator it, int moreData)
{
    //Useful stuff here
}

In general case types tObj * and vector<tObj>::iterator are different types though in some old realizations of std::vector its iterator is indeed defined as a pointer..


it is an iterator object, passing it as-is would mean you're trying to pass an object of type vector<tObj>::iterator for a function expecting tObj*, and thus the error.

When you do *it you'd get the underlying object the iterator is representing and when you apply & atop that, you get that object's address, which is of type tObj* which agrees with the function's argument type and thus no error.