So I learned about iterators a few weeks ago and I decided to review today to keep things fresh in my mind. What i really couldn't understand is the use of "begin()" in a random access iterator.
Integer1 = Iter1 - begin(Elements);
What does it mean when you subtract the begin iterator? I know the index value for the beginning of an array is 0, so are you subtracting nothing? Please clarify.
When you do iterator arithmetic (only allowed on random access iterators, remember), you don't really subtract the index that the iterator represents, you perform pseudo pointer-arithmetic on the iterators themselves. So if I have "int i = someIterator - container.begin()" I assign "i" to the number of elements between "someIterator" and "container.begin()".