ptr_vector requiring non-const iterator for insert
Hi, I noticed that ptr_vector requires a non-const iterator for insert. This is inherited from ptr_sequence_adapter, which defines iterator insert( iterator position, T* x ); Under C++11, this differs from std::vector, which, since C++11, is happy to take const_iterators. iterator insert( const_iterator pos, const T& value ); I read somewhere that C++11 was attempting to clear up some confusion in the standard between iterator constness and container constness. Just wondering whether this should be adopted (e.g. changed) in ptr containers. Gave me an error when I switched from vector to ptr_vector in a drop-in fashion. Not sure whether that is already planned, but google didn't find anything. Florian
On 31-05-2014 12:05, Florian Burkart wrote:
Hi,
I noticed that ptr_vector requires a non-const iterator for insert.
This is inherited from ptr_sequence_adapter, which defines
iterator insert( iterator position, T* x );
Under C++11, this differs from std::vector, which, since C++11, is happy to take const_iterators.
iterator insert( const_iterator pos, const T& value );
I read somewhere that C++11 was attempting to clear up some confusion in the standard between iterator constness and container constness.
Just wondering whether this should be adopted (e.g. changed) in ptr containers.
It should. I guess if you file a bug fix, it could happen. -Thorsten
participants (2)
-
Florian Burkart
-
Thorsten Ottosen