]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
2016-06-15 François Dumont <fdumont@gcc.gnu.org>
authorFrançois Dumont <fdumont@gcc.gnu.org>
Wed, 15 Jun 2016 20:09:56 +0000 (20:09 +0000)
committerFrançois Dumont <fdumont@gcc.gnu.org>
Wed, 15 Jun 2016 20:09:56 +0000 (20:09 +0000)
* include/bits/stl_deque.h
(std::deque<>::operator=): Call _M_assign_aux.
(std::deque<>::assign(initializer_list<>)): Likewise.
(std::deque<>::resize(size_t, const value_type&)): Call _M_fill_insert.
(std::deque<>::insert(const_iterator, initializer_list<>)):
Call _M_range_insert_aux.
(std::deque<>::_M_assign_aux<It>(It, It, std::forward_iterator_tag):
Likewise.
(std::deque<>::_M_fill_assign): Call _M_fill_insert.
(std::deque<>::_M_move_assign2): Call _M_assign_aux.
* include/bits/deque.tcc
(std::deque<>::operator=): Call _M_range_insert_aux.
(std::deque<>::_M_assign_aux<It>(It, It, std::input_iterator_tag)):
Likewise.
* include/bits/stl_vector.h
(std::vector<>::operator=): Call _M_assign_aux.
(std::vector<>::assign(initializer_list<>)): Likewise.
(std::vector<>::resize(size_t, const value_type&)): Call _M_fill_insert.
(std::vector<>::insert(const_iterator, initializer_list<>)):
Call _M_range_insert.
* include/bits/vector.tcc (std::vector<>::_M_assign_aux): Likewise.

From-SVN: r237495

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/deque.tcc
libstdc++-v3/include/bits/stl_deque.h
libstdc++-v3/include/bits/stl_vector.h
libstdc++-v3/include/bits/vector.tcc

index 7166f39489120cc7cdae67bb30ea46e7fb577c6d..c1848aa2a25b41b94d916f752a2cab82f13f6b88 100644 (file)
@@ -1,3 +1,27 @@
+2016-06-15  François Dumont  <fdumont@gcc.gnu.org>
+
+       * include/bits/stl_deque.h
+       (std::deque<>::operator=): Call _M_assign_aux.
+       (std::deque<>::assign(initializer_list<>)): Likewise.
+       (std::deque<>::resize(size_t, const value_type&)): Call _M_fill_insert.
+       (std::deque<>::insert(const_iterator, initializer_list<>)):
+       Call _M_range_insert_aux.
+       (std::deque<>::_M_assign_aux<It>(It, It, std::forward_iterator_tag):
+       Likewise.
+       (std::deque<>::_M_fill_assign): Call _M_fill_insert.
+       (std::deque<>::_M_move_assign2): Call _M_assign_aux.
+       * include/bits/deque.tcc
+       (std::deque<>::operator=): Call _M_range_insert_aux.
+       (std::deque<>::_M_assign_aux<It>(It, It, std::input_iterator_tag)):
+       Likewise.
+       * include/bits/stl_vector.h
+       (std::vector<>::operator=): Call _M_assign_aux.
+       (std::vector<>::assign(initializer_list<>)): Likewise.
+       (std::vector<>::resize(size_t, const value_type&)): Call _M_fill_insert.
+       (std::vector<>::insert(const_iterator, initializer_list<>)):
+       Call _M_range_insert.
+       * include/bits/vector.tcc (std::vector<>::_M_assign_aux): Likewise.
+
 2016-06-07  François Dumont  <fdumont@gcc.gnu.org>
 
        * include/std/tuple (_Head_base<>): Default specialization condition at
index b1dab643f3523d7557987363362647634ff517a0..96ec9f82d8f0c7254aebe7d2fa209b3c06b09d03 100644 (file)
@@ -119,7 +119,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
            {
              const_iterator __mid = __x.begin() + difference_type(__len);
              std::copy(__x.begin(), __mid, this->_M_impl._M_start);
-             insert(this->_M_impl._M_finish, __mid, __x.end());
+             _M_range_insert_aux(this->_M_impl._M_finish, __mid, __x.end(),
+                                 std::random_access_iterator_tag());
            }
        }
       return *this;
@@ -280,7 +281,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
         if (__first == __last)
           _M_erase_at_end(__cur);
         else
-          insert(end(), __first, __last);
+          _M_range_insert_aux(end(), __first, __last,
+                             std::__iterator_category(__first));
       }
 
   template <typename _Tp, typename _Alloc>
index d7a9d523e3a0140fdc8a9c8153ea00fd49c1e0df..f63ae4c0ba5b845e23cfa30c440cce714e290968 100644 (file)
@@ -1081,7 +1081,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       deque&
       operator=(initializer_list<value_type> __l)
       {
-       this->assign(__l.begin(), __l.end());
+       _M_assign_aux(__l.begin(), __l.end(),
+                     random_access_iterator_tag());
        return *this;
       }
 #endif
@@ -1142,7 +1143,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
        */
       void
       assign(initializer_list<value_type> __l)
-      { this->assign(__l.begin(), __l.end()); }
+      { _M_assign_aux(__l.begin(), __l.end(), random_access_iterator_tag()); }
 #endif
 
       /// Get a copy of the memory allocation object.
@@ -1306,7 +1307,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       {
        const size_type __len = size();
        if (__new_size > __len)
-         insert(this->_M_impl._M_finish, __new_size - __len, __x);
+         _M_fill_insert(this->_M_impl._M_finish, __new_size - __len, __x);
        else if (__new_size < __len)
          _M_erase_at_end(this->_M_impl._M_start
                          + difference_type(__new_size));
@@ -1328,7 +1329,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       {
        const size_type __len = size();
        if (__new_size > __len)
-         insert(this->_M_impl._M_finish, __new_size - __len, __x);
+         _M_fill_insert(this->_M_impl._M_finish, __new_size - __len, __x);
        else if (__new_size < __len)
          _M_erase_at_end(this->_M_impl._M_start
                          + difference_type(__new_size));
@@ -1645,7 +1646,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
        */
       iterator
       insert(const_iterator __p, initializer_list<value_type> __l)
-      { return this->insert(__p, __l.begin(), __l.end()); }
+      {
+       auto __offset = __p - cbegin();
+       _M_range_insert_aux(__p._M_const_cast(), __l.begin(), __l.end(),
+                           std::random_access_iterator_tag());
+       return begin() + __offset;
+      }
 #endif
 
 #if __cplusplus >= 201103L
@@ -1819,9 +1825,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
         _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
                               __false_type)
         {
-         typedef typename std::iterator_traits<_InputIterator>::
-           iterator_category _IterCategory;
-         _M_range_initialize(__first, __last, _IterCategory());
+         _M_range_initialize(__first, __last,
+                             std::__iterator_category(__first));
        }
 
       // called by the second initialize_dispatch above
@@ -1884,11 +1889,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
         void
         _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
                           __false_type)
-        {
-         typedef typename std::iterator_traits<_InputIterator>::
-           iterator_category _IterCategory;
-         _M_assign_aux(__first, __last, _IterCategory());
-       }
+       { _M_assign_aux(__first, __last, std::__iterator_category(__first)); }
 
       // called by the second assign_dispatch above
       template<typename _InputIterator>
@@ -1908,7 +1909,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
              _ForwardIterator __mid = __first;
              std::advance(__mid, size());
              std::copy(__first, __mid, begin());
-             insert(end(), __mid, __last);
+             _M_range_insert_aux(end(), __mid, __last,
+                                 std::__iterator_category(__first));
            }
          else
            _M_erase_at_end(std::copy(__first, __last, begin()));
@@ -1922,7 +1924,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
        if (__n > size())
          {
            std::fill(begin(), end(), __val);
-           insert(end(), __n - size(), __val);
+           _M_fill_insert(end(), __n - size(), __val);
          }
        else
          {
@@ -1970,9 +1972,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
                           _InputIterator __first, _InputIterator __last,
                           __false_type)
         {
-         typedef typename std::iterator_traits<_InputIterator>::
-           iterator_category _IterCategory;
-          _M_range_insert_aux(__pos, __first, __last, _IterCategory());
+          _M_range_insert_aux(__pos, __first, __last,
+                             std::__iterator_category(__first));
        }
 
       // called by the second insert_dispatch above
@@ -2196,8 +2197,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
          {
            // The rvalue's allocator cannot be moved and is not equal,
            // so we need to individually move each element.
-           this->assign(std::__make_move_if_noexcept_iterator(__x.begin()),
-                        std::__make_move_if_noexcept_iterator(__x.end()));
+           _M_assign_aux(std::__make_move_if_noexcept_iterator(__x.begin()),
+                         std::__make_move_if_noexcept_iterator(__x.end()),
+                         std::random_access_iterator_tag());
            __x.clear();
          }
       }
index 9b6d258f6ca4edb140ae503957dadc5687fedf0d..8badea375cc3fe30ca7b8cd67db4459ad9799641 100644 (file)
@@ -72,7 +72,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
     struct _Vector_base
     {
       typedef typename __gnu_cxx::__alloc_traits<_Alloc>::template
-        rebind<_Tp>::other _Tp_alloc_type;
+       rebind<_Tp>::other _Tp_alloc_type;
       typedef typename __gnu_cxx::__alloc_traits<_Tp_alloc_type>::pointer
                pointer;
 
@@ -214,30 +214,30 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
     class vector : protected _Vector_base<_Tp, _Alloc>
     {
       // Concept requirements.
-      typedef typename _Alloc::value_type                _Alloc_value_type;
+      typedef typename _Alloc::value_type              _Alloc_value_type;
 #if __cplusplus < 201103L
       __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
 #endif
       __glibcxx_class_requires2(_Tp, _Alloc_value_type, _SameTypeConcept)
       
-      typedef _Vector_base<_Tp, _Alloc>                         _Base;
-      typedef typename _Base::_Tp_alloc_type            _Tp_alloc_type;
-      typedef __gnu_cxx::__alloc_traits<_Tp_alloc_type>  _Alloc_traits;
+      typedef _Vector_base<_Tp, _Alloc>                        _Base;
+      typedef typename _Base::_Tp_alloc_type           _Tp_alloc_type;
+      typedef __gnu_cxx::__alloc_traits<_Tp_alloc_type>        _Alloc_traits;
 
     public:
-      typedef _Tp                                       value_type;
-      typedef typename _Base::pointer                    pointer;
-      typedef typename _Alloc_traits::const_pointer      const_pointer;
-      typedef typename _Alloc_traits::reference          reference;
-      typedef typename _Alloc_traits::const_reference    const_reference;
+      typedef _Tp                                      value_type;
+      typedef typename _Base::pointer                  pointer;
+      typedef typename _Alloc_traits::const_pointer    const_pointer;
+      typedef typename _Alloc_traits::reference                reference;
+      typedef typename _Alloc_traits::const_reference  const_reference;
       typedef __gnu_cxx::__normal_iterator<pointer, vector> iterator;
       typedef __gnu_cxx::__normal_iterator<const_pointer, vector>
       const_iterator;
-      typedef std::reverse_iterator<const_iterator>  const_reverse_iterator;
-      typedef std::reverse_iterator<iterator>           reverse_iterator;
-      typedef size_t                                    size_type;
-      typedef ptrdiff_t                                         difference_type;
-      typedef _Alloc                                    allocator_type;
+      typedef std::reverse_iterator<const_iterator>    const_reverse_iterator;
+      typedef std::reverse_iterator<iterator>          reverse_iterator;
+      typedef size_t                                   size_type;
+      typedef ptrdiff_t                                        difference_type;
+      typedef _Alloc                                   allocator_type;
 
     protected:
       using _Base::_M_allocate;
@@ -319,8 +319,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
        */
       vector(const vector& __x)
       : _Base(__x.size(),
-        _Alloc_traits::_S_select_on_copy(__x._M_get_Tp_allocator()))
-      { this->_M_impl._M_finish =
+       _Alloc_traits::_S_select_on_copy(__x._M_get_Tp_allocator()))
+      {
+       this->_M_impl._M_finish =
          std::__uninitialized_copy_a(__x.begin(), __x.end(),
                                      this->_M_impl._M_start,
                                      _M_get_Tp_allocator());
@@ -340,7 +341,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       /// Copy constructor with alternative allocator
       vector(const vector& __x, const allocator_type& __a)
       : _Base(__x.size(), __a)
-      { this->_M_impl._M_finish =
+      {
+       this->_M_impl._M_finish =
          std::__uninitialized_copy_a(__x.begin(), __x.end(),
                                      this->_M_impl._M_start,
                                      _M_get_Tp_allocator());
@@ -400,16 +402,16 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
 #if __cplusplus >= 201103L
       template<typename _InputIterator,
               typename = std::_RequireInputIter<_InputIterator>>
-        vector(_InputIterator __first, _InputIterator __last,
+       vector(_InputIterator __first, _InputIterator __last,
               const allocator_type& __a = allocator_type())
        : _Base(__a)
-        { _M_initialize_dispatch(__first, __last, __false_type()); }
+       { _M_initialize_dispatch(__first, __last, __false_type()); }
 #else
       template<typename _InputIterator>
-        vector(_InputIterator __first, _InputIterator __last,
+       vector(_InputIterator __first, _InputIterator __last,
               const allocator_type& __a = allocator_type())
        : _Base(__a)
-        {
+       {
          // Check whether it's an integral type.  If so, it's not an iterator.
          typedef typename std::__is_integer<_InputIterator>::__type _Integral;
          _M_initialize_dispatch(__first, __last, _Integral());
@@ -449,10 +451,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       vector&
       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
       {
-        constexpr bool __move_storage =
-          _Alloc_traits::_S_propagate_on_move_assign()
-          || _Alloc_traits::_S_always_equal();
-        _M_move_assign(std::move(__x), __bool_constant<__move_storage>());
+       constexpr bool __move_storage =
+         _Alloc_traits::_S_propagate_on_move_assign()
+         || _Alloc_traits::_S_always_equal();
+       _M_move_assign(std::move(__x), __bool_constant<__move_storage>());
        return *this;
       }
 
@@ -470,7 +472,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       vector&
       operator=(initializer_list<value_type> __l)
       {
-       this->assign(__l.begin(), __l.end());
+       this->_M_assign_aux(__l.begin(), __l.end(),
+                           random_access_iterator_tag());
        return *this;
       }
 #endif
@@ -504,14 +507,14 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
 #if __cplusplus >= 201103L
       template<typename _InputIterator,
               typename = std::_RequireInputIter<_InputIterator>>
-        void
-        assign(_InputIterator __first, _InputIterator __last)
-        { _M_assign_dispatch(__first, __last, __false_type()); }
+       void
+       assign(_InputIterator __first, _InputIterator __last)
+       { _M_assign_dispatch(__first, __last, __false_type()); }
 #else
       template<typename _InputIterator>
-        void
-        assign(_InputIterator __first, _InputIterator __last)
-        {
+       void
+       assign(_InputIterator __first, _InputIterator __last)
+       {
          // Check whether it's an integral type.  If so, it's not an iterator.
          typedef typename std::__is_integer<_InputIterator>::__type _Integral;
          _M_assign_dispatch(__first, __last, _Integral());
@@ -532,7 +535,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
        */
       void
       assign(initializer_list<value_type> __l)
-      { this->assign(__l.begin(), __l.end()); }
+      {
+       this->_M_assign_aux(__l.begin(), __l.end(),
+                           random_access_iterator_tag());
+      }
 #endif
 
       /// Get a copy of the memory allocation object.
@@ -694,7 +700,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       resize(size_type __new_size, const value_type& __x)
       {
        if (__new_size > size())
-         insert(end(), __new_size - size(), __x);
+         _M_fill_insert(end(), __new_size - size(), __x);
        else if (__new_size < size())
          _M_erase_at_end(this->_M_impl._M_start + __new_size);
       }
@@ -714,7 +720,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       resize(size_type __new_size, value_type __x = value_type())
       {
        if (__new_size > size())
-         insert(end(), __new_size - size(), __x);
+         _M_fill_insert(end(), __new_size - size(), __x);
        else if (__new_size < size())
          _M_erase_at_end(this->_M_impl._M_start + __new_size);
       }
@@ -916,7 +922,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
        if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage)
          {
            _Alloc_traits::construct(this->_M_impl, this->_M_impl._M_finish,
-                                    __x);
+                                    __x);
            ++this->_M_impl._M_finish;
          }
        else
@@ -933,8 +939,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       { emplace_back(std::move(__x)); }
 
       template<typename... _Args>
-        void
-        emplace_back(_Args&&... __args);
+       void
+       emplace_back(_Args&&... __args);
 #endif
 
       /**
@@ -967,8 +973,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
        *  std::list.
        */
       template<typename... _Args>
-        iterator
-        emplace(const_iterator __position, _Args&&... __args);
+       iterator
+       emplace(const_iterator __position, _Args&&... __args);
 
       /**
        *  @brief  Inserts given value into %vector before specified iterator.
@@ -1030,7 +1036,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
        */
       iterator
       insert(const_iterator __position, initializer_list<value_type> __l)
-      { return this->insert(__position, __l.begin(), __l.end()); }
+      {
+       auto __offset = __position - cbegin();
+       _M_range_insert(begin() + __offset, __l.begin(), __l.end(),
+                       std::random_access_iterator_tag());
+       return begin() + __offset;
+      }
 #endif
 
 #if __cplusplus >= 201103L
@@ -1092,10 +1103,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
        */
       template<typename _InputIterator,
               typename = std::_RequireInputIter<_InputIterator>>
-        iterator
-        insert(const_iterator __position, _InputIterator __first,
+       iterator
+       insert(const_iterator __position, _InputIterator __first,
               _InputIterator __last)
-        {
+       {
          difference_type __offset = __position - cbegin();
          _M_insert_dispatch(begin() + __offset,
                             __first, __last, __false_type());
@@ -1117,10 +1128,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
        *  consider using std::list.
        */
       template<typename _InputIterator>
-        void
-        insert(iterator __position, _InputIterator __first,
+       void
+       insert(iterator __position, _InputIterator __first,
               _InputIterator __last)
-        {
+       {
          // Check whether it's an integral type.  If so, it's not an iterator.
          typedef typename std::__is_integer<_InputIterator>::__type _Integral;
          _M_insert_dispatch(__position, __first, __last, _Integral());
@@ -1196,7 +1207,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       {
        this->_M_impl._M_swap_data(__x._M_impl);
        _Alloc_traits::_S_on_swap(_M_get_Tp_allocator(),
-                                 __x._M_get_Tp_allocator());
+                                 __x._M_get_Tp_allocator());
       }
 
       /**
@@ -1215,10 +1226,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
        *  obtain @a n bytes of memory, and then copies [first,last) into it.
        */
       template<typename _ForwardIterator>
-        pointer
-        _M_allocate_and_copy(size_type __n,
+       pointer
+       _M_allocate_and_copy(size_type __n,
                             _ForwardIterator __first, _ForwardIterator __last)
-        {
+       {
          pointer __result = this->_M_allocate(__n);
          __try
            {
@@ -1241,9 +1252,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       // _GLIBCXX_RESOLVE_LIB_DEFECTS
       // 438. Ambiguity in the "do the right thing" clause
       template<typename _Integer>
-        void
-        _M_initialize_dispatch(_Integer __n, _Integer __value, __true_type)
-        {
+       void
+       _M_initialize_dispatch(_Integer __n, _Integer __value, __true_type)
+       {
          this->_M_impl._M_start = _M_allocate(static_cast<size_type>(__n));
          this->_M_impl._M_end_of_storage =
            this->_M_impl._M_start + static_cast<size_type>(__n);
@@ -1252,10 +1263,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
 
       // Called by the range constructor to implement [23.1.1]/9
       template<typename _InputIterator>
-        void
-        _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
+       void
+       _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
                               __false_type)
-        {
+       {
          typedef typename std::iterator_traits<_InputIterator>::
            iterator_category _IterCategory;
          _M_range_initialize(__first, __last, _IterCategory());
@@ -1263,10 +1274,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
 
       // Called by the second initialize_dispatch above
       template<typename _InputIterator>
-        void
-        _M_range_initialize(_InputIterator __first,
+       void
+       _M_range_initialize(_InputIterator __first,
                            _InputIterator __last, std::input_iterator_tag)
-        {
+       {
          for (; __first != __last; ++__first)
 #if __cplusplus >= 201103L
            emplace_back(*__first);
@@ -1277,10 +1288,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
 
       // Called by the second initialize_dispatch above
       template<typename _ForwardIterator>
-        void
-        _M_range_initialize(_ForwardIterator __first,
+       void
+       _M_range_initialize(_ForwardIterator __first,
                            _ForwardIterator __last, std::forward_iterator_tag)
-        {
+       {
          const size_type __n = std::distance(__first, __last);
          this->_M_impl._M_start = this->_M_allocate(__n);
          this->_M_impl._M_end_of_storage = this->_M_impl._M_start + __n;
@@ -1319,31 +1330,27 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       // _GLIBCXX_RESOLVE_LIB_DEFECTS
       // 438. Ambiguity in the "do the right thing" clause
       template<typename _Integer>
-        void
-        _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
-        { _M_fill_assign(__n, __val); }
+       void
+       _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
+       { _M_fill_assign(__n, __val); }
 
       // Called by the range assign to implement [23.1.1]/9
       template<typename _InputIterator>
-        void
-        _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
+       void
+       _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
                           __false_type)
-        {
-         typedef typename std::iterator_traits<_InputIterator>::
-           iterator_category _IterCategory;
-         _M_assign_aux(__first, __last, _IterCategory());
-       }
+       { _M_assign_aux(__first, __last, std::__iterator_category(__first)); }
 
       // Called by the second assign_dispatch above
       template<typename _InputIterator>
-        void
-        _M_assign_aux(_InputIterator __first, _InputIterator __last,
+       void
+       _M_assign_aux(_InputIterator __first, _InputIterator __last,
                      std::input_iterator_tag);
 
       // Called by the second assign_dispatch above
       template<typename _ForwardIterator>
-        void
-        _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last,
+       void
+       _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last,
                      std::forward_iterator_tag);
 
       // Called by assign(n,t), and the range assign when it turns out
@@ -1351,7 +1358,6 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       void
       _M_fill_assign(size_type __n, const value_type& __val);
 
-
       // Internal insert functions follow.
 
       // Called by the range insert to implement [23.1.1]/9
@@ -1359,32 +1365,31 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       // _GLIBCXX_RESOLVE_LIB_DEFECTS
       // 438. Ambiguity in the "do the right thing" clause
       template<typename _Integer>
-        void
-        _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __val,
+       void
+       _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __val,
                           __true_type)
-        { _M_fill_insert(__pos, __n, __val); }
+       { _M_fill_insert(__pos, __n, __val); }
 
       // Called by the range insert to implement [23.1.1]/9
       template<typename _InputIterator>
-        void
-        _M_insert_dispatch(iterator __pos, _InputIterator __first,
+       void
+       _M_insert_dispatch(iterator __pos, _InputIterator __first,
                           _InputIterator __last, __false_type)
-        {
-         typedef typename std::iterator_traits<_InputIterator>::
-           iterator_category _IterCategory;
-         _M_range_insert(__pos, __first, __last, _IterCategory());
+       {
+         _M_range_insert(__pos, __first, __last,
+                         std::__iterator_category(__first));
        }
 
       // Called by the second insert_dispatch above
       template<typename _InputIterator>
-        void
-        _M_range_insert(iterator __pos, _InputIterator __first,
+       void
+       _M_range_insert(iterator __pos, _InputIterator __first,
                        _InputIterator __last, std::input_iterator_tag);
 
       // Called by the second insert_dispatch above
       template<typename _ForwardIterator>
-        void
-        _M_range_insert(iterator __pos, _ForwardIterator __first,
+       void
+       _M_range_insert(iterator __pos, _ForwardIterator __first,
                        _ForwardIterator __last, std::forward_iterator_tag);
 
       // Called by insert(p,n,x), and the range insert when it turns out to be
@@ -1407,12 +1412,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       _M_insert_aux(iterator __position, const value_type& __x);
 #else
       template<typename... _Args>
-        void
-        _M_insert_aux(iterator __position, _Args&&... __args);
+       void
+       _M_insert_aux(iterator __position, _Args&&... __args);
 
       template<typename... _Args>
-        void
-        _M_emplace_back_aux(_Args&&... __args);
+       void
+       _M_emplace_back_aux(_Args&&... __args);
 #endif
 
       // Called by the latter.
index 715b83eb67928ae7b6b1a69b7934ac2c4b6fb77e..93a8dc1002d5d8b6d3b2afccae9dc51004f82907 100644 (file)
@@ -256,7 +256,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
        if (__first == __last)
          _M_erase_at_end(__cur);
        else
-         insert(end(), __first, __last);
+         _M_range_insert(end(), __first, __last,
+                         std::__iterator_category(__first));
       }
 
   template<typename _Tp, typename _Alloc>