templates - C++ get Index value in integer from iterator -


i trying index value iterator. keep getting error "indirection requires pointer operand ('long' invalid)" idea? need index. on following example, should output 2.

template<typename t> void practice(t begin, t end) {     t = begin;     it++;     it++;     auto index = - begin;     cout << *index; 

cout << index; 

no need * dereference.


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -