Paul Melis wrote:
Jean-Sébastien Guay wrote:
Hi Ulrich,

You're right that what you (and Robert) note is an error (i.e. assigning an iterator from one container to an iterator from another container).

But...

I don't believe this is the problem. The 'it = container.erase(it)' construct is correct.

It seems that according to the standard, it is, but some (many?) versions of gcc don't support it (perhaps it was added late in the standardization process or whatever). I've run across the same problem as Wang Rui - map::erase(iterator) returns void on some common compilers. So it's not portable code (by gcc's fault but still...).
According to the "spec" I have here (ISO C++ 1998 draft) std::map::erase(it) should return void (and same for std::set). Only for sequential containers (vector, list, deque) is an iterator returned in case of erase()ing. Makes sense too, as associative containers are usually not implemented as a simple list of elements, so returning the next item after the one just erased could be tricky.
Interestingly, the c0x draft I could find indeed lists std::map::erase(it) (and for set as well) as returning an interator.

Paul


_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to