Hey,

Jean-Sébastien Guay wrote:

According to the "spec" I have here (ISO C++ 1998 draft) std::map::erase(it) should return void (and same for std::set).

The version I have is dated October 2008. Here's a link:

http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2008/n2798.pdf

From here:

http://www.open-std.org/JTC1/SC22/WG21/

See page 838:

  iterator  erase(const_iterator position);
  size_type erase(const key_type& x);
  iterator  erase(const_iterator first, const_iterator last);

So yeah, it was probably added later.
The inconsistency in void <-> iterator return type seems to have been marked as defect (DR 130) shortly after the previous C++ spec was published in 1998. DR 130 is dated March 1990: http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#130

The DR proposes to change erase() from returning void to returning an iterator.

Anyways, the result is that some (all? I'm not sure) versions of gcc don't support the version that return an iterator, and return void instead. VC++ does. Does this mark the first time VC++ is more up-to-date than gcc with regards to standards? :-)
From what I can find about this is that Dinkumware STL (which is what VS is using) has chosen to return iterators for erase(). I guess you could say that any conforming code using erase() must ignore the return value, as it is prescribed to be void. An STL implementation that differs in return type will also work with conforming code, as the result value is ignored anyway. So perhaps it is code using Dinkumware STL (VS) that expects an iterator as result value that is non-conforming...

Paul



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

Reply via email to