stl_deque.h (deque<>::insert(iterator, size_type, const value_type&), [...]): Adjust...
authorPaolo Carlini <paolo.carlini@oracle.com>
Sun, 30 Jun 2013 16:24:30 +0000 (16:24 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Sun, 30 Jun 2013 16:24:30 +0000 (16:24 +0000)
2013-06-30  Paolo Carlini  <paolo.carlini@oracle.com>

* include/bits/stl_deque.h (deque<>::insert(iterator,
size_type, const value_type&), deque<>::insert(iterator,
initializer_list<>), deque<>::insert(iterator, _InputIterator,
_InputIterator)): Adjust C++11 signatures to take a const_iterator.
* include/bits/stl_vector.h: Likewise.
* include/bits/stl_bvector.h: Likewise.
* include/debug/deque: Adjust.
* include/debug/vector: Likewise.
* include/profile/deque: Likewise.
* include/profile/vector: Likewise.
* testsuite/23_containers/deque/modifiers/insert/const_iterator.cc:
Extend.
* testsuite/23_containers/vector/bool/modifiers/insert/
const_iterator.cc: Likewise.
* testsuite/23_containers/vector/modifiers/insert/const_iterator.cc:
Likewise.

* testsuite/23_containers/deque/requirements/dr438/assign_neg.cc:
Adjust dg-error line number.
* testsuite/23_containers/deque/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/deque/requirements/dr438/
constructor_2_neg.cc: Likewise.
* testsuite/23_containers/deque/requirements/dr438/insert_neg.cc:
Likewise.
* testsuite/23_containers/vector/requirements/dr438/assign_neg.cc:
Likewise.
* testsuite/23_containers/vector/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/vector/requirements/dr438/
constructor_2_neg.cc: Likewise.
* testsuite/23_containers/vector/requirements/dr438/insert_neg.cc:
Likewise.

From-SVN: r200571

19 files changed:
libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/stl_bvector.h
libstdc++-v3/include/bits/stl_deque.h
libstdc++-v3/include/bits/stl_vector.h
libstdc++-v3/include/debug/deque
libstdc++-v3/include/debug/vector
libstdc++-v3/include/profile/deque
libstdc++-v3/include/profile/vector
libstdc++-v3/testsuite/23_containers/deque/modifiers/insert/const_iterator.cc
libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc
libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc
libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc
libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc
libstdc++-v3/testsuite/23_containers/vector/bool/modifiers/insert/const_iterator.cc
libstdc++-v3/testsuite/23_containers/vector/modifiers/insert/const_iterator.cc
libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc
libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc
libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc
libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc

index 1ae52c2bf58d7429945b0024b2c3522d0e8a29e3..14c49db86d24b6e5f7dcb3918a2bd8e636cb1150 100644 (file)
@@ -1,3 +1,39 @@
+2013-06-30  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       * include/bits/stl_deque.h (deque<>::insert(iterator,
+       size_type, const value_type&), deque<>::insert(iterator,
+       initializer_list<>), deque<>::insert(iterator, _InputIterator,
+       _InputIterator)): Adjust C++11 signatures to take a const_iterator.
+       * include/bits/stl_vector.h: Likewise.
+       * include/bits/stl_bvector.h: Likewise.
+       * include/debug/deque: Adjust.
+       * include/debug/vector: Likewise.
+       * include/profile/deque: Likewise.
+       * include/profile/vector: Likewise.
+       * testsuite/23_containers/deque/modifiers/insert/const_iterator.cc:
+       Extend.
+       * testsuite/23_containers/vector/bool/modifiers/insert/
+       const_iterator.cc: Likewise.
+       * testsuite/23_containers/vector/modifiers/insert/const_iterator.cc:
+       Likewise.
+
+       * testsuite/23_containers/deque/requirements/dr438/assign_neg.cc:
+       Adjust dg-error line number.
+       * testsuite/23_containers/deque/requirements/dr438/
+       constructor_1_neg.cc: Likewise.
+       * testsuite/23_containers/deque/requirements/dr438/
+       constructor_2_neg.cc: Likewise.
+       * testsuite/23_containers/deque/requirements/dr438/insert_neg.cc:
+       Likewise.
+       * testsuite/23_containers/vector/requirements/dr438/assign_neg.cc:
+       Likewise.
+       * testsuite/23_containers/vector/requirements/dr438/
+       constructor_1_neg.cc: Likewise.
+       * testsuite/23_containers/vector/requirements/dr438/
+       constructor_2_neg.cc: Likewise.
+       * testsuite/23_containers/vector/requirements/dr438/insert_neg.cc:
+       Likewise.
+
 2013-06-27  Paolo Carlini  <paolo.carlini@oracle.com>
 
        * testsuite/21_strings/basic_string/operations/*: Move inside
index 489d819f06fc1907036e243c8713c97dc2261044..887ea16ae556578decca7e9d26351bb57470638e 100644 (file)
@@ -881,10 +881,15 @@ template<typename _Alloc>
 #if __cplusplus >= 201103L
     template<typename _InputIterator,
             typename = std::_RequireInputIter<_InputIterator>>
-      void
-      insert(iterator __position,
+      iterator
+      insert(const_iterator __position,
             _InputIterator __first, _InputIterator __last)
-      { _M_insert_dispatch(__position, __first, __last, __false_type()); }
+      {
+       difference_type __offset = __position - cbegin();
+       _M_insert_dispatch(__position._M_const_cast(),
+                          __first, __last, __false_type());
+       return begin() + __offset;
+      }
 #else
     template<typename _InputIterator>
       void
@@ -896,13 +901,24 @@ template<typename _Alloc>
       }
 #endif
 
+#if __cplusplus >= 201103L
+    iterator
+    insert(const_iterator __position, size_type __n, const bool& __x)
+    {
+      difference_type __offset = __position - cbegin();
+      _M_fill_insert(__position._M_const_cast(), __n, __x);
+      return begin() + __offset;
+    }
+#else
     void
     insert(iterator __position, size_type __n, const bool& __x)
     { _M_fill_insert(__position, __n, __x); }
+#endif
 
 #if __cplusplus >= 201103L
-    void insert(iterator __p, initializer_list<bool> __l)
-    { this->insert(__p, __l.begin(), __l.end()); }
+    iterator
+    insert(const_iterator __p, initializer_list<bool> __l)
+    { return this->insert(__p, __l.begin(), __l.end()); }
 #endif
 
     void
index a03ba256b53a15a47f5f4dfde110de61eb42030d..a4656734469e35563d36b1f33f87a2b66f5aac1b 100644 (file)
@@ -1517,11 +1517,30 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
        *  initializer_list @a __l into the %deque before the location
        *  specified by @a __p.  This is known as <em>list insert</em>.
        */
-      void
-      insert(iterator __p, initializer_list<value_type> __l)
-      { this->insert(__p, __l.begin(), __l.end()); }
+      iterator
+      insert(const_iterator __p, initializer_list<value_type> __l)
+      { return this->insert(__p, __l.begin(), __l.end()); }
 #endif
 
+#if __cplusplus >= 201103L
+      /**
+       *  @brief  Inserts a number of copies of given data into the %deque.
+       *  @param  __position  A const_iterator into the %deque.
+       *  @param  __n  Number of elements to be inserted.
+       *  @param  __x  Data to be inserted.
+       *  @return  An iterator that points to the inserted data.
+       *
+       *  This function will insert a specified number of copies of the given
+       *  data before the location specified by @a __position.
+       */
+      iterator
+      insert(const_iterator __position, size_type __n, const value_type& __x)
+      {
+       difference_type __offset = __position - cbegin();
+       _M_fill_insert(__position._M_const_cast(), __n, __x);
+       return begin() + __offset;
+      }
+#else
       /**
        *  @brief  Inserts a number of copies of given data into the %deque.
        *  @param  __position  An iterator into the %deque.
@@ -1534,25 +1553,42 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       void
       insert(iterator __position, size_type __n, const value_type& __x)
       { _M_fill_insert(__position, __n, __x); }
+#endif
 
+#if __cplusplus >= 201103L
       /**
        *  @brief  Inserts a range into the %deque.
-       *  @param  __position  Aiterator into the %deque.
+       *  @param  __position  A const_iterator into the %deque.
        *  @param  __first  An input iterator.
        *  @param  __last   An input iterator.
+       *  @return  An iterator that points to the inserted data.
        *
        *  This function will insert copies of the data in the range
        *  [__first,__last) into the %deque before the location specified
        *  by @a __position.  This is known as <em>range insert</em>.
        */
-#if __cplusplus >= 201103L
       template<typename _InputIterator,
               typename = std::_RequireInputIter<_InputIterator>>
-        void
-        insert(iterator __position, _InputIterator __first,
+        iterator
+        insert(const_iterator __position, _InputIterator __first,
               _InputIterator __last)
-        { _M_insert_dispatch(__position, __first, __last, __false_type()); }
+        {
+         difference_type __offset = __position - cbegin();
+         _M_insert_dispatch(__position._M_const_cast(),
+                            __first, __last, __false_type());
+         return begin() + __offset;
+       }
 #else
+      /**
+       *  @brief  Inserts a range into the %deque.
+       *  @param  __position  An iterator into the %deque.
+       *  @param  __first  An input iterator.
+       *  @param  __last   An input iterator.
+       *
+       *  This function will insert copies of the data in the range
+       *  [__first,__last) into the %deque before the location specified
+       *  by @a __position.  This is known as <em>range insert</em>.
+       */
       template<typename _InputIterator>
         void
         insert(iterator __position, _InputIterator __first,
index a403b4f83bb33d366493fc67f42b8a3bd28ef478..726693918a3fadc94e5fecf021eb53d48c220417 100644 (file)
@@ -1015,11 +1015,34 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
        *  %vector and if it is frequently used the user should
        *  consider using std::list.
        */
-      void
-      insert(iterator __position, initializer_list<value_type> __l)
-      { this->insert(__position, __l.begin(), __l.end()); }
+      iterator
+      insert(const_iterator __position, initializer_list<value_type> __l)
+      { return this->insert(__position, __l.begin(), __l.end()); }
 #endif
 
+#if __cplusplus >= 201103L
+      /**
+       *  @brief  Inserts a number of copies of given data into the %vector.
+       *  @param  __position  A const_iterator into the %vector.
+       *  @param  __n  Number of elements to be inserted.
+       *  @param  __x  Data to be inserted.
+       *  @return  An iterator that points to the inserted data.
+       *
+       *  This function will insert a specified number of copies of
+       *  the given data before the location specified by @a position.
+       *
+       *  Note that this kind of operation could be expensive for a
+       *  %vector and if it is frequently used the user should
+       *  consider using std::list.
+       */
+      iterator
+      insert(const_iterator __position, size_type __n, const value_type& __x)
+      {
+       difference_type __offset = __position - cbegin();
+       _M_fill_insert(__position._M_const_cast(), __n, __x);
+       return begin() + __offset;
+      }
+#else
       /**
        *  @brief  Inserts a number of copies of given data into the %vector.
        *  @param  __position  An iterator into the %vector.
@@ -1036,12 +1059,15 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       void
       insert(iterator __position, size_type __n, const value_type& __x)
       { _M_fill_insert(__position, __n, __x); }
+#endif
 
+#if __cplusplus >= 201103L
       /**
        *  @brief  Inserts a range into the %vector.
-       *  @param  __position  Aiterator into the %vector.
+       *  @param  __position  A const_iterator into the %vector.
        *  @param  __first  An input iterator.
        *  @param  __last   An input iterator.
+       *  @return  An iterator that points to the inserted data.
        *
        *  This function will insert copies of the data in the range
        *  [__first,__last) into the %vector before the location specified
@@ -1051,14 +1077,32 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
        *  %vector and if it is frequently used the user should
        *  consider using std::list.
        */
-#if __cplusplus >= 201103L
       template<typename _InputIterator,
               typename = std::_RequireInputIter<_InputIterator>>
-        void
-        insert(iterator __position, _InputIterator __first,
+        iterator
+        insert(const_iterator __position, _InputIterator __first,
               _InputIterator __last)
-        { _M_insert_dispatch(__position, __first, __last, __false_type()); }
+        {
+         difference_type __offset = __position - cbegin();
+         _M_insert_dispatch(__position._M_const_cast(),
+                            __first, __last, __false_type());
+         return begin() + __offset;
+       }
 #else
+      /**
+       *  @brief  Inserts a range into the %vector.
+       *  @param  __position  An iterator into the %vector.
+       *  @param  __first  An input iterator.
+       *  @param  __last   An input iterator.
+       *
+       *  This function will insert copies of the data in the range
+       *  [__first,__last) into the %vector before the location specified
+       *  by @a pos.
+       *
+       *  Note that this kind of operation could be expensive for a
+       *  %vector and if it is frequently used the user should
+       *  consider using std::list.
+       */
       template<typename _InputIterator>
         void
         insert(iterator __position, _InputIterator __first,
index 638bf1cd3ca1e07accfa59ce07529e2f2d8e436d..e5e902dfc7b09e59db141f8a2860630be37f066a 100644 (file)
@@ -411,14 +411,26 @@ namespace __debug
       insert(const_iterator __position, _Tp&& __x)
       { return emplace(__position, std::move(__x)); }
 
-      void
-      insert(iterator __p, initializer_list<value_type> __l)
+      iterator
+      insert(const_iterator __position, initializer_list<value_type> __l)
       {
-       _Base::insert(__p, __l);
+       __glibcxx_check_insert(__position);
+       _Base_iterator __res = _Base::insert(__position.base(), __l);
        this->_M_invalidate_all();
+       return iterator(__res, this);
       }
 #endif
 
+#if __cplusplus >= 201103L
+      iterator
+      insert(const_iterator __position, size_type __n, const _Tp& __x)
+      {
+       __glibcxx_check_insert(__position);
+       _Base_iterator __res = _Base::insert(__position.base(), __n, __x);
+       this->_M_invalidate_all();
+       return iterator(__res, this);
+      }
+#else
       void
       insert(iterator __position, size_type __n, const _Tp& __x)
       {
@@ -426,13 +438,24 @@ namespace __debug
        _Base::insert(__position.base(), __n, __x);
        this->_M_invalidate_all();
       }
+#endif
 
 #if __cplusplus >= 201103L
       template<class _InputIterator,
               typename = std::_RequireInputIter<_InputIterator>>
+       iterator
+        insert(const_iterator __position,
+              _InputIterator __first, _InputIterator __last)
+        {
+         __glibcxx_check_insert_range(__position, __first, __last);
+         _Base_iterator __res = _Base::insert(__position.base(),
+                                              __gnu_debug::__base(__first),
+                                              __gnu_debug::__base(__last));
+         this->_M_invalidate_all();
+         return iterator(__res, this);
+       }
 #else
       template<class _InputIterator>
-#endif
         void
         insert(iterator __position,
               _InputIterator __first, _InputIterator __last)
@@ -442,6 +465,7 @@ namespace __debug
                                           __gnu_debug::__base(__last));
          this->_M_invalidate_all();
        }
+#endif
 
       void
       pop_front()
index f55dc67ede019e1ddb1256de63bda98dc38d9f36..7b28177c2a0a9028f367af4c48046a8120d432db 100644 (file)
@@ -471,11 +471,27 @@ namespace __debug
         insert(const_iterator __position, _Tp&& __x)
         { return emplace(__position, std::move(__x)); }
 
-      void
-      insert(iterator __position, initializer_list<value_type> __l)
-      { this->insert(__position, __l.begin(), __l.end()); }
+      iterator
+      insert(const_iterator __position, initializer_list<value_type> __l)
+      { return this->insert(__position, __l.begin(), __l.end()); }
 #endif
 
+#if __cplusplus >= 201103L
+      iterator
+      insert(const_iterator __position, size_type __n, const _Tp& __x)
+      {
+       __glibcxx_check_insert(__position);
+       bool __realloc = _M_requires_reallocation(this->size() + __n);
+       difference_type __offset = __position.base() - _Base::cbegin();
+       _Base_iterator __res = _Base::insert(__position.base(), __n, __x);
+       if (__realloc)
+         this->_M_invalidate_all();
+       else
+         this->_M_invalidate_after_nth(__offset);
+       _M_update_guaranteed_capacity();
+       return iterator(__res, this);
+      }
+#else
       void
       insert(iterator __position, size_type __n, const _Tp& __x)
       {
@@ -489,13 +505,35 @@ namespace __debug
          this->_M_invalidate_after_nth(__offset);
        _M_update_guaranteed_capacity();
       }
+#endif
 
 #if __cplusplus >= 201103L
       template<class _InputIterator,
               typename = std::_RequireInputIter<_InputIterator>>
+        iterator
+        insert(const_iterator __position,
+              _InputIterator __first, _InputIterator __last)
+        {
+         __glibcxx_check_insert_range(__position, __first, __last);
+
+         /* Hard to guess if invalidation will occur, because __last
+            - __first can't be calculated in all cases, so we just
+            punt here by checking if it did occur. */
+         _Base_iterator __old_begin = _M_base().begin();
+         difference_type __offset = __position.base() - _Base::cbegin();
+         _Base_iterator __res = _Base::insert(__position.base(),
+                                              __gnu_debug::__base(__first),
+                                              __gnu_debug::__base(__last));
+
+         if (_M_base().begin() != __old_begin)
+           this->_M_invalidate_all();
+         else
+           this->_M_invalidate_after_nth(__offset);
+         _M_update_guaranteed_capacity();
+         return iterator(__res, this);
+       }
 #else
       template<class _InputIterator>
-#endif
         void
         insert(iterator __position,
               _InputIterator __first, _InputIterator __last)
@@ -516,6 +554,7 @@ namespace __debug
            this->_M_invalidate_after_nth(__offset);
          _M_update_guaranteed_capacity();
        }
+#endif
 
       iterator
 #if __cplusplus >= 201103L
index 0ec98386baefcb0c5d41e18ab88f990077f3dee7..c46618e27e4a1bdde128282059b64995be7eaa70 100644 (file)
@@ -344,31 +344,35 @@ namespace __profile
       insert(const_iterator __position, _Tp&& __x)
       { return emplace(__position, std::move(__x)); }
 
-      void
-      insert(iterator __p, initializer_list<value_type> __l)
-      {
-       _Base::insert(__p, __l);
-      }
+      iterator
+      insert(const_iterator __p, initializer_list<value_type> __l)
+      { return _Base::insert(__p, __l); }
 #endif
 
+#if __cplusplus >= 201103L
+      iterator
+      insert(const_iterator __position, size_type __n, const _Tp& __x)
+      { return _Base::insert(__position, __n, __x); }
+#else
       void
       insert(iterator __position, size_type __n, const _Tp& __x)
-      {
-       _Base::insert(__position, __n, __x);
-      }
+      { _Base::insert(__position, __n, __x); }
+#endif
 
 #if __cplusplus >= 201103L
       template<typename _InputIterator,
               typename = std::_RequireInputIter<_InputIterator>>
+        iterator
+        insert(const_iterator __position,
+              _InputIterator __first, _InputIterator __last)
+        { return _Base::insert(__position, __first, __last); }
 #else
       template<typename _InputIterator>
-#endif
         void
         insert(iterator __position,
               _InputIterator __first, _InputIterator __last)
-        {
-         _Base::insert(__position, __first, __last);
-       }
+        { _Base::insert(__position, __first, __last); }
+#endif
 
       void
       pop_front()
index de058d0d8142f69e2c45b4915530de70463efaaf..3ef04ff0a7c5f5c4ede5c4c4ecbe6666c6520177 100644 (file)
@@ -44,6 +44,9 @@ namespace __profile
     {
       typedef _GLIBCXX_STD_C::vector<_Tp, _Allocator> _Base;
 
+      typedef typename _Base::iterator _Base_iterator;
+      typedef typename _Base::const_iterator _Base_const_iterator;
+
 #if __cplusplus >= 201103L
       typedef __gnu_cxx::__alloc_traits<_Allocator>  _Alloc_traits;
 #endif
@@ -52,9 +55,9 @@ namespace __profile
       typedef typename _Base::reference             reference;
       typedef typename _Base::const_reference       const_reference;
 
-      typedef __iterator_tracker<typename _Base::iterator, vector>
+      typedef __iterator_tracker<_Base_iterator, vector>
                                                     iterator;
-      typedef __iterator_tracker<typename _Base::const_iterator, vector>
+      typedef __iterator_tracker<_Base_const_iterator, vector>
                                                    const_iterator;
 
       typedef typename _Base::size_type             size_type;
@@ -361,7 +364,7 @@ namespace __profile
         __profcxx_vector_insert(this, __position.base() - _Base::begin(),
                                 this->size());
         size_type __old_size = this->capacity();
-       typename _Base::iterator __res = _Base::insert(__position.base(), __x);
+       _Base_iterator __res = _Base::insert(__position.base(), __x);
         _M_profile_resize(this, __old_size, this->capacity());
        return iterator(__res, this);
       }
@@ -370,10 +373,10 @@ namespace __profile
       iterator
       insert(const_iterator __position, _Tp&& __x)
       {
-        __profcxx_vector_insert(this, __position.base() - _Base::begin(),
+        __profcxx_vector_insert(this, __position.base() - _Base::cbegin(),
                                 this->size());
         size_type __old_size = this->capacity();
-       typename _Base::iterator __res = _Base::insert(__position.base(), __x);
+       _Base_iterator __res = _Base::insert(__position.base(), __x);
         _M_profile_resize(this, __old_size, this->capacity());
        return iterator(__res, this);
       }
@@ -382,15 +385,14 @@ namespace __profile
         iterator
         emplace(const_iterator __position, _Args&&... __args)
         {
-         typename _Base::iterator __res
-           = _Base::emplace(__position.base(),
-                            std::forward<_Args>(__args)...);
+         _Base_iterator __res = _Base::emplace(__position.base(),
+                                               std::forward<_Args>(__args)...);
          return iterator(__res, this);
        }
 
-      void
-      insert(iterator __position, initializer_list<value_type> __l)
-      { this->insert(__position, __l.begin(), __l.end()); }
+      iterator
+      insert(const_iterator __position, initializer_list<value_type> __l)
+      { return this->insert(__position, __l.begin(), __l.end()); }
 #endif
 
 #if __cplusplus >= 201103L
@@ -404,12 +406,24 @@ namespace __profile
       void
       swap(vector& __x)
 #if __cplusplus >= 201103L
-                       noexcept(_Alloc_traits::_S_nothrow_swap())
+      noexcept(_Alloc_traits::_S_nothrow_swap())
 #endif
       {
         _Base::swap(__x);
       }
 
+#if __cplusplus >= 201103L
+      iterator
+      insert(const_iterator __position, size_type __n, const _Tp& __x)
+      {
+        __profcxx_vector_insert(this, __position.base() - _Base::cbegin(),
+                                this->size());
+        size_type __old_size = this->capacity();
+        _Base_iterator __res = _Base::insert(__position, __n, __x);
+        _M_profile_resize(this, __old_size, this->capacity());
+       return iterator(__res, this);
+      }
+#else
       void
       insert(iterator __position, size_type __n, const _Tp& __x)
       {
@@ -419,23 +433,35 @@ namespace __profile
         _Base::insert(__position, __n, __x);
         _M_profile_resize(this, __old_size, this->capacity());
       }
+#endif
 
 #if __cplusplus >= 201103L
       template<typename _InputIterator,
               typename = std::_RequireInputIter<_InputIterator>>
+       iterator
+       insert(const_iterator __position,
+              _InputIterator __first, _InputIterator __last)
+        {
+         __profcxx_vector_insert(this, __position.base() - _Base::cbegin(),
+                                 this->size());
+         size_type __old_size = this->capacity();
+         _Base_iterator __res = _Base::insert(__position, __first, __last);
+         _M_profile_resize(this, __old_size, this->capacity());
+         return iterator(__res, this);
+       }
 #else
       template<typename _InputIterator>
+       void
+       insert(iterator __position,
+              _InputIterator __first, _InputIterator __last)
+        {
+         __profcxx_vector_insert(this, __position.base() - _Base::begin(),
+                                 this->size());
+         size_type __old_size = this->capacity();
+         _Base::insert(__position, __first, __last);
+         _M_profile_resize(this, __old_size, this->capacity());
+       }
 #endif
-      void
-      insert(iterator __position,
-             _InputIterator __first, _InputIterator __last)
-      {
-        __profcxx_vector_insert(this, __position.base()-_Base::begin(),
-                                this->size());
-        size_type __old_size = this->capacity();
-        _Base::insert(__position, __first, __last);
-        _M_profile_resize(this, __old_size, this->capacity());
-      }
 
       iterator
 #if __cplusplus >= 201103L
@@ -444,7 +470,7 @@ namespace __profile
       erase(iterator __position)       
 #endif
       {
-       typename _Base::iterator __res = _Base::erase(__position.base());
+       _Base_iterator __res = _Base::erase(__position.base());
        return iterator(__res, this);
       }
 
@@ -457,8 +483,7 @@ namespace __profile
       {
        // _GLIBCXX_RESOLVE_LIB_DEFECTS
        // 151. can't currently clear() empty container
-       typename _Base::iterator __res = _Base::erase(__first.base(),
-                                                      __last.base());
+       _Base_iterator __res = _Base::erase(__first.base(), __last.base());
        return iterator(__res, this);
       }
 
index 915aa688a91e2bb4040c302b035027c68c16e93f..9af2bc908864425af564e23919fd178ae2faa96e 100644 (file)
@@ -24,6 +24,9 @@ void test01()
 {
   std::deque<int> d1;
   int n = 0;
-  d1.insert(d1.cbegin(), n);
-  d1.insert(d1.cbegin(), 1);
+  std::deque<int>::iterator it = d1.insert(d1.cbegin(), n);
+  it = d1.insert(d1.cbegin(), 1);
+  it = d1.insert(d1.cbegin(), {2, 3});
+  it = d1.insert(d1.cbegin(), 1, 4);
+  it = d1.insert(d1.cbegin(), d1.begin(), d1.end());
 }
index 9788b4d952d980debe3104894723908d5f5df972..7558ac7d8558c2a06f26a3bb0eaae7baac3441a9 100644 (file)
@@ -18,7 +18,7 @@
 // <http://www.gnu.org/licenses/>.
 
 // { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1724 }
+// { dg-error "no matching" "" { target *-*-* } 1760 }
 
 #include <deque>
 
index a85b5c3f9f8fa872b8f38bf96aa2d0f62bb4a473..ee6b721d9d39854a63008d0e929c067931109b69 100644 (file)
@@ -18,7 +18,7 @@
 // <http://www.gnu.org/licenses/>.
 
 // { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1657 }
+// { dg-error "no matching" "" { target *-*-* } 1693 }
 
 #include <deque>
 
index 162bdf0bf95af104d295054850c5ae0b9c6da930..d36964efa4e1c0056c5e8e69552828601315a27f 100644 (file)
@@ -18,7 +18,7 @@
 // <http://www.gnu.org/licenses/>.
 
 // { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1657 }
+// { dg-error "no matching" "" { target *-*-* } 1693 }
 
 #include <deque>
 #include <utility>
index 7e8356fd7632f9bb47d38a190ee5f76bb1c7135c..cda684d29f5b3526eb798602cc12301767b1cfb8 100644 (file)
@@ -18,7 +18,7 @@
 // <http://www.gnu.org/licenses/>.
 
 // { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1808 }
+// { dg-error "no matching" "" { target *-*-* } 1844 }
 
 #include <deque>
 
index b8993d84342190116c3a99244a1616979e60f404..93f3d9287115cc895c3c088e33d6e5b4972261bf 100644 (file)
@@ -23,5 +23,8 @@
 void test01()
 {
   std::vector<bool> vb1;
-  vb1.insert(vb1.cbegin(), true);
+  std::vector<bool>::iterator it = vb1.insert(vb1.cbegin(), true);
+  it = vb1.insert(vb1.cbegin(), {false, true});
+  it = vb1.insert(vb1.cbegin(), 1, false);
+  it = vb1.insert(vb1.cbegin(), vb1.begin(), vb1.end());  
 }
index 5e5ef9e37398ed128f8b3c8d2399c33fe9577996..b1bf91edc221ee1214611ad87e15fcba57aeef43 100644 (file)
@@ -24,6 +24,9 @@ void test01()
 {
   std::vector<int> v1;
   int n = 0;
-  v1.insert(v1.cbegin(), n);
-  v1.insert(v1.cbegin(), 1);
+  std::vector<int>::iterator it = v1.insert(v1.cbegin(), n);
+  it = v1.insert(v1.cbegin(), 1);
+  it = v1.insert(v1.cbegin(), {2, 3});
+  it = v1.insert(v1.cbegin(), 1, 4);
+  it = v1.insert(v1.cbegin(), v1.begin(), v1.end());
 }
index e94346772821cbbb0c2bd6a7df0712dc8e3aee74..f7353ab325caead9506de1b47b0e7f9d6cb84a3a 100644 (file)
@@ -18,7 +18,7 @@
 // <http://www.gnu.org/licenses/>.
 
 // { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1264 }
+// { dg-error "no matching" "" { target *-*-* } 1308 }
 
 #include <vector>
 
index ba14bcef2addc5e67a56b19f87faa69f291c9d10..f404a7009da36bbd2b00a59b0fc95b19dd565b98 100644 (file)
@@ -18,7 +18,7 @@
 // <http://www.gnu.org/licenses/>.
 
 // { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1190 }
+// { dg-error "no matching" "" { target *-*-* } 1234 }
 
 #include <vector>
 
index c9ac43782c4f4b97052331798cc9b8c51b645e9d..070295676a543e44cadd9ee8baaf00c8094ab5df 100644 (file)
@@ -18,7 +18,7 @@
 // <http://www.gnu.org/licenses/>.
 
 // { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1190 }
+// { dg-error "no matching" "" { target *-*-* } 1234 }
 
 #include <vector>
 #include <utility>
index 343edc2c7f3a4b92fa02e307e6251a6ee81d1855..95af05795ce858a78dd6d56e6ce35015c9e533cf 100644 (file)
@@ -18,7 +18,7 @@
 // <http://www.gnu.org/licenses/>.
 
 // { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1305 }
+// { dg-error "no matching" "" { target *-*-* } 1349 }
 
 #include <vector>