i have gone through both the list iterator
m_iter_item & Iter_item from begin to end.
using _ptr->_Next and _ptr->_Prev
addresses in both the iterators are identical.
i have no clue why ++*this is crashing.
code in the above case is:
-----------------------------------------
1> class dummy
2> {
3> ..
4> ..
5> private:
6> list<mItem>::iterator m_iter_item;
7> }
8>
9> void dummy::func1()
10> {
11> list<mItem>::iterator iter_item;
12> getItem(&iter_item);
13> m_iter_item = iter_item;
14> ..
15> m_iter_item++;
16> ...
17> }
-----------------------------------------
when i changed the function func1() as
9> void dummy::func1()
10> {
11> list<mItem>::iterator iter_item;
12> getItem(&m_iter_item);
13> ..
14> m_iter_item++;
15> ...
16> }
there is no problem at all.
regards,
srinivas
Daniel T. wrote:
> "srinivas" <> wrote:
> >
> > is assignment of an iterator to another iterator valid?
> > i have found this assignment is creating problem.
> >
> > m_iter_item = iter_item;
> > m_iter_item++;
>
> Assignment from one object to another of the same type is valid if the
> class was written such that it is valid. The above code does not compile
> on its own (which does create a problem. 
>
> You probably need to provide a valid op=.