I have an iterator to a class, a class whose main data structure is just an array. I set the iterator to point to the first element in the array, then i to this:
&(*iter)
where iter is the iterator and *iter will dereference the pointer (returning a const reference to the item its pointing to). However, the address that results when the above is executed is not the address of the first element in the array. Why is this so?
Sample code:
using vc6Code:class A { int arr*; // assume space is allocated for this in constructor public: class Iter{...}; ... } A a; A::Iter iter = a.begin(); // initializing iter to the first element in arr &(*iter) // != a.arr