V
Vikram Karandikar
Hi all,
I have class something like this
class Y
{
....
};
class X
{
public:
map <uint32_t, Y *> yList;
map <uint32_t, Y *>::iterator yListIter;
X ()
{
yListIter = yList.begin ();
}
add (Y *obj)
{
yList [obj->key] = obj;
}
}
Program
X x;
map <uint32_t, Y *>::iterator i1;
x.add (new Y (1));
i1 = x.yListIter;
x.add (new Y(2));
My question is can i safely assume that i1 is always valid if there are only new things getting added to the map?
If delete is going to happen i will reset if to begin.
Thanks in advance.
I have class something like this
class Y
{
....
};
class X
{
public:
map <uint32_t, Y *> yList;
map <uint32_t, Y *>::iterator yListIter;
X ()
{
yListIter = yList.begin ();
}
add (Y *obj)
{
yList [obj->key] = obj;
}
}
Program
X x;
map <uint32_t, Y *>::iterator i1;
x.add (new Y (1));
i1 = x.yListIter;
x.add (new Y(2));
My question is can i safely assume that i1 is always valid if there are only new things getting added to the map?
If delete is going to happen i will reset if to begin.
Thanks in advance.