This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

C++11 N2256 vector::insert at const_iterator


In 2007, there was a proposal to change the insert and erase
functions of std::vector so that the location in the vector can
be given as a const_iterator, rather than requiring a non-const
iterator.
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2256.html
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2350.pdf

I don't have the final C++11 standard but it seems this change
was accepted.
http://gcc.gnu.org/onlinedocs/libstdc++/ext/lwg-defects.html#180
http://en.cppreference.com/w/cpp/container/vector/insert
http://msdn.microsoft.com/en-us/library/s5bta5ha%28v=vs.110%29.aspx

In libstdc++ of GCC though, insert requires a non-const iterator,
whether or not __GXX_EXPERIMENTAL_CXX0X__ is defined.
http://gcc.gnu.org/viewcvs/trunk/libstdc%2B%2B-v3/include/bits/stl_vector.h?revision=181189&view=markup#l970

PR libstdc++/44436 mentions const_iterator in insert and erase,
but it is about associative containers, so I don't think it
covers std::vector.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44436#c9

Is this omission already covered by some line in the "C++ 2011
Implementation Status" table?
http://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#status.iso.200x


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]