S
subramanian100in
Suppose I have
vector<int> container;
Suppose I store some values into "container".
Suppose that "left" and "right" are valid iterators into "container"
and that "right" is NOT container.end() and "right" comes after
"left".
Given this, suppose
vector<int>::iterator iter = container.erase(left, right);
then "iter" will always be a copy of "right" iterator.
ie
if (iter == right) will always be true. Am I correct ? The same is
true for deque and list also. Is this correct ?
Given a standard library container, can we call clear() function on
empty container ? Or will it invoke undefined behaviour ?
Kindly clarify.
Thanks
V.Subramanian
vector<int> container;
Suppose I store some values into "container".
Suppose that "left" and "right" are valid iterators into "container"
and that "right" is NOT container.end() and "right" comes after
"left".
Given this, suppose
vector<int>::iterator iter = container.erase(left, right);
then "iter" will always be a copy of "right" iterator.
ie
if (iter == right) will always be true. Am I correct ? The same is
true for deque and list also. Is this correct ?
Given a standard library container, can we call clear() function on
empty container ? Or will it invoke undefined behaviour ?
Kindly clarify.
Thanks
V.Subramanian