Re: removing multiple values in a set



SvenC <SvenC@xxxxxxxxxxxxxxxx> wrote:
if(result.Compare("Error")==0) {
remotenodeip.erase(itr++); // must use post-increment

I would prefer to use the return value as it was designed to return a
valid iterator:

itr = remotenodeip.erase(itr);

According to the C++ standard, set::erase returns void, so your code is
non-portable. For more details, see

http://groups.google.com/group/microsoft.public.vc.stl/browse_frm/thread/4fe24e875127a3e5/c12ac74b8360c21b

in particular the last five posts in that thread.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925


.


Loading