Reputation:
I am trying to get the index value from iterator. But I keep getting the error "Indirection requires pointer operand ('long' invalid)" Any idea? I need to get the index. on the following example, it should output 2.
template<typename T>
void practice(T begin, T end) {
T it = begin;
it++;
it++;
auto index = it - begin;
cout << *index;
Upvotes: 2
Views: 169