]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
stl_deque.h (deque<>::push_back<>(_Args...), [...]): Add.
authorChris Jefferson <chris@bubblescope.net>
Mon, 12 Nov 2007 16:01:09 +0000 (16:01 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Mon, 12 Nov 2007 16:01:09 +0000 (16:01 +0000)
2007-11-12  Chris Jefferson  <chris@bubblescope.net>
    Paolo Carlini  <pcarlini@suse.de>

* include/bits/stl_deque.h (deque<>::push_back<>(_Args...),
deque<>::push_front<>(_Args...), emplace<>(iterator, _Args...),
insert(iterator, _Tp&&), _M_push_back_aux<>(_Args&&...),
_M_push_front_aux<>(_Args&&...), _M_insert_aux<>(iterator,
_Args&&...)): Add.
* include/deque/deque.tcc (insert(iterator, value_type&&),
emplace<>(iterator, _Args...), _M_push_back_aux<>(_Args&&...),
_M_push_front_aux<>(_Args&&...), _M_insert_aux<>(iterator,
_Args&&...)): Define.
(_M_insert_aux(iterator, size_type, const value_type&),
_M_insert_aux<>(iterator, _ForwardIterator, _ForwardIterator,
size_type)): Use _GLIBCXX_MOVE3, _GLIBCXX_MOVE_BACKWARD3,
__uninitialized_move*, __uninitialized_fill_move,
__uninitialized_copy_move, when possible.
* include/bits/stl_uninitialized.h (__uninitialized_copy_copy,
__uninitialized_fill_copy, __uninitialized_copy_fill): Remove.
(__uninitialized_copy_move, __uninitialized_move_copy,
__uninitialized_move_fill, __uninitialized_fill_move): Add.
* include/debug/deque (deque<>::push_back<>(_Args...),
deque<>::push_front<>(_Args...), emplace<>(iterator, _Args...),
insert(iterator, _Tp&&)): Add.
* testsuite/23_containers/deque/modifiers/moveable.cc: Enable.
* testsuite/23_containers/deque/capacity/moveable.cc: Likewise.
* testsuite/23_containers/deque/cons/moveable.cc: Likewise.
* testsuite/23_containers/deque/requirements/dr438/assign_neg.cc:
Adjust dg-error line numbers.
* testsuite/23_containers/deque/requirements/dr438/insert_neg.cc:
Likewise.
* testsuite/23_containers/deque/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/deque/requirements/dr438/
constructor_2_neg.cc: Likewise.

* include/debug/vector (vector<>::insert(iterator, _Tp&&)): Minor
tweak, prefer std::move.

Co-Authored-By: Paolo Carlini <pcarlini@suse.de>
From-SVN: r130102

13 files changed:
libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/deque.tcc
libstdc++-v3/include/bits/stl_deque.h
libstdc++-v3/include/bits/stl_uninitialized.h
libstdc++-v3/include/debug/deque
libstdc++-v3/include/debug/vector
libstdc++-v3/testsuite/23_containers/deque/capacity/moveable.cc
libstdc++-v3/testsuite/23_containers/deque/cons/moveable.cc
libstdc++-v3/testsuite/23_containers/deque/modifiers/moveable.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

index 94e8449b5d29f071aec38e7826ee10ed47249597..826b602321149604752d6badc12e223a4a8a82d0 100644 (file)
@@ -1,3 +1,42 @@
+2007-11-12  Chris Jefferson  <chris@bubblescope.net>
+           Paolo Carlini  <pcarlini@suse.de>
+
+       * include/bits/stl_deque.h (deque<>::push_back<>(_Args...),
+       deque<>::push_front<>(_Args...), emplace<>(iterator, _Args...),
+       insert(iterator, _Tp&&), _M_push_back_aux<>(_Args&&...),
+       _M_push_front_aux<>(_Args&&...), _M_insert_aux<>(iterator,
+       _Args&&...)): Add.
+       * include/deque/deque.tcc (insert(iterator, value_type&&),
+       emplace<>(iterator, _Args...), _M_push_back_aux<>(_Args&&...),
+       _M_push_front_aux<>(_Args&&...), _M_insert_aux<>(iterator,
+       _Args&&...)): Define.
+       (_M_insert_aux(iterator, size_type, const value_type&),
+       _M_insert_aux<>(iterator, _ForwardIterator, _ForwardIterator,
+       size_type)): Use _GLIBCXX_MOVE3, _GLIBCXX_MOVE_BACKWARD3,
+       __uninitialized_move*, __uninitialized_fill_move,
+       __uninitialized_copy_move, when possible.
+       * include/bits/stl_uninitialized.h (__uninitialized_copy_copy,
+       __uninitialized_fill_copy, __uninitialized_copy_fill): Remove.
+       (__uninitialized_copy_move, __uninitialized_move_copy,
+       __uninitialized_move_fill, __uninitialized_fill_move): Add.
+       * include/debug/deque (deque<>::push_back<>(_Args...),
+       deque<>::push_front<>(_Args...), emplace<>(iterator, _Args...),
+       insert(iterator, _Tp&&)): Add.
+       * testsuite/23_containers/deque/modifiers/moveable.cc: Enable.
+       * testsuite/23_containers/deque/capacity/moveable.cc: Likewise.
+       * testsuite/23_containers/deque/cons/moveable.cc: Likewise.
+       * testsuite/23_containers/deque/requirements/dr438/assign_neg.cc:
+       Adjust dg-error line numbers.
+       * testsuite/23_containers/deque/requirements/dr438/insert_neg.cc:
+       Likewise.
+       * testsuite/23_containers/deque/requirements/dr438/
+       constructor_1_neg.cc: Likewise.
+       * testsuite/23_containers/deque/requirements/dr438/
+       constructor_2_neg.cc: Likewise.
+
+       * include/debug/vector (vector<>::insert(iterator, _Tp&&)): Minor
+       tweak, prefer std::move.
+
 2007-11-11  Howard Hinnant  <hhinnant@apple.com>
 
        * include/bits/stl_pair.h (pair<>::pair<>(_U1&&, _Arg0&&,
index 5e9b8923f2242c49a5312a159af5134934975640..25544e94f2cdecd82fbdb1229d13b94d859468bb 100644 (file)
@@ -106,6 +106,51 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
         return _M_insert_aux(__position, __x);
     }
 
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+  template<typename _Tp, typename _Alloc>
+    typename deque<_Tp, _Alloc>::iterator
+    deque<_Tp, _Alloc>::
+    insert(iterator __position, value_type&& __x)
+    {
+      if (__position._M_cur == this->_M_impl._M_start._M_cur)
+       {
+         push_front(std::move(__x));
+         return this->_M_impl._M_start;
+       }
+      else if (__position._M_cur == this->_M_impl._M_finish._M_cur)
+       {
+         push_back(std::move(__x));
+         iterator __tmp = this->_M_impl._M_finish;
+         --__tmp;
+         return __tmp;
+       }
+      else
+        return _M_insert_aux(__position, std::move(__x));
+    }
+
+  template<typename _Tp, typename _Alloc>
+    template<typename... _Args>
+      typename deque<_Tp, _Alloc>::iterator
+      deque<_Tp, _Alloc>::
+      emplace(iterator __position, _Args&&... __args)
+      {
+       if (__position._M_cur == this->_M_impl._M_start._M_cur)
+         {
+           push_front(std::forward<_Args>(__args)...);
+           return this->_M_impl._M_start;
+         }
+       else if (__position._M_cur == this->_M_impl._M_finish._M_cur)
+         {
+           push_back(std::forward<_Args>(__args)...);
+           iterator __tmp = this->_M_impl._M_finish;
+           --__tmp;
+           return __tmp;
+         }
+       else
+         return _M_insert_aux(__position, std::forward<_Args>(__args)...);
+      }
+#endif
+
   template <typename _Tp, typename _Alloc>
     typename deque<_Tp, _Alloc>::iterator
     deque<_Tp, _Alloc>::
@@ -299,51 +344,71 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
       }
 
   // Called only if _M_impl._M_finish._M_cur == _M_impl._M_finish._M_last - 1.
-  template <typename _Tp, typename _Alloc>
-    void
-    deque<_Tp, _Alloc>::
-    _M_push_back_aux(const value_type& __t)
-    {
-      value_type __t_copy = __t;
-      _M_reserve_map_at_back();
-      *(this->_M_impl._M_finish._M_node + 1) = this->_M_allocate_node();
-      try
-        {
-          this->_M_impl.construct(this->_M_impl._M_finish._M_cur, __t_copy);
-          this->_M_impl._M_finish._M_set_node(this->_M_impl._M_finish._M_node
-                                             + 1);
-          this->_M_impl._M_finish._M_cur = this->_M_impl._M_finish._M_first;
-        }
-      catch(...)
-        {
-          _M_deallocate_node(*(this->_M_impl._M_finish._M_node + 1));
-          __throw_exception_again;
-        }
-    }
+  template<typename _Tp, typename _Alloc>
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+    template<typename... _Args>
+      void
+      deque<_Tp, _Alloc>::
+      _M_push_back_aux(_Args&&... __args)
+      {
+       value_type __t_copy(std::forward<_Args>(__args)...);
+#else
+      void
+      deque<_Tp, _Alloc>::
+      _M_push_back_aux(const value_type& __t)
+      {
+       value_type __t_copy = __t;
+#endif
+       _M_reserve_map_at_back();
+       *(this->_M_impl._M_finish._M_node + 1) = this->_M_allocate_node();
+       try
+         {
+           this->_M_impl.construct(this->_M_impl._M_finish._M_cur,
+                                   _GLIBCXX_MOVE(__t_copy));
+           this->_M_impl._M_finish._M_set_node(this->_M_impl._M_finish._M_node
+                                               + 1);
+           this->_M_impl._M_finish._M_cur = this->_M_impl._M_finish._M_first;
+         }
+       catch(...)
+         {
+           _M_deallocate_node(*(this->_M_impl._M_finish._M_node + 1));
+           __throw_exception_again;
+         }
+      }
 
   // Called only if _M_impl._M_start._M_cur == _M_impl._M_start._M_first.
-  template <typename _Tp, typename _Alloc>
-    void
-    deque<_Tp, _Alloc>::
-    _M_push_front_aux(const value_type& __t)
-    {
-      value_type __t_copy = __t;
-      _M_reserve_map_at_front();
-      *(this->_M_impl._M_start._M_node - 1) = this->_M_allocate_node();
-      try
-        {
-          this->_M_impl._M_start._M_set_node(this->_M_impl._M_start._M_node
-                                            - 1);
-          this->_M_impl._M_start._M_cur = this->_M_impl._M_start._M_last - 1;
-          this->_M_impl.construct(this->_M_impl._M_start._M_cur, __t_copy);
-        }
-      catch(...)
-        {
-          ++this->_M_impl._M_start;
-          _M_deallocate_node(*(this->_M_impl._M_start._M_node - 1));
-          __throw_exception_again;
-        }
-    }
+  template<typename _Tp, typename _Alloc>
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+    template<typename... _Args>
+      void
+      deque<_Tp, _Alloc>::
+      _M_push_front_aux(_Args&&... __args)
+      {
+       value_type __t_copy(std::forward<_Args>(__args)...);
+#else
+      void
+      deque<_Tp, _Alloc>::
+      _M_push_front_aux(const value_type& __t)
+      {
+       value_type __t_copy = __t;
+#endif
+       _M_reserve_map_at_front();
+       *(this->_M_impl._M_start._M_node - 1) = this->_M_allocate_node();
+       try
+         {
+           this->_M_impl._M_start._M_set_node(this->_M_impl._M_start._M_node
+                                              - 1);
+           this->_M_impl._M_start._M_cur = this->_M_impl._M_start._M_last - 1;
+           this->_M_impl.construct(this->_M_impl._M_start._M_cur,
+                                   _GLIBCXX_MOVE(__t_copy));
+         }
+       catch(...)
+         {
+           ++this->_M_impl._M_start;
+           _M_deallocate_node(*(this->_M_impl._M_start._M_node - 1));
+           __throw_exception_again;
+         }
+      }
 
   // Called only if _M_impl._M_finish._M_cur == _M_impl._M_finish._M_first.
   template <typename _Tp, typename _Alloc>
@@ -426,38 +491,47 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
           _M_insert_aux(__pos, __first, __last, __n);
       }
 
-  template <typename _Tp, typename _Alloc>
+  template<typename _Tp, typename _Alloc>
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+    template<typename... _Args>
+      typename deque<_Tp, _Alloc>::iterator
+      deque<_Tp, _Alloc>::
+      _M_insert_aux(iterator __pos, _Args&&... __args)
+      {
+       value_type __x_copy(std::forward<_Args>(__args)...); // XXX copy
+#else
     typename deque<_Tp, _Alloc>::iterator
-    deque<_Tp, _Alloc>::
-    _M_insert_aux(iterator __pos, const value_type& __x)
-    {
-      difference_type __index = __pos - this->_M_impl._M_start;
-      value_type __x_copy = __x; // XXX copy
-      if (static_cast<size_type>(__index) < size() / 2)
-       {
-         push_front(front());
-         iterator __front1 = this->_M_impl._M_start;
-         ++__front1;
-         iterator __front2 = __front1;
-         ++__front2;
-         __pos = this->_M_impl._M_start + __index;
-         iterator __pos1 = __pos;
-         ++__pos1;
-         std::copy(__front2, __pos1, __front1);
-       }
-      else
-       {
-         push_back(back());
-         iterator __back1 = this->_M_impl._M_finish;
-         --__back1;
-         iterator __back2 = __back1;
-         --__back2;
-         __pos = this->_M_impl._M_start + __index;
-         std::copy_backward(__pos, __back2, __back1);
-       }
-      *__pos = __x_copy;
-      return __pos;
-    }
+      deque<_Tp, _Alloc>::
+      _M_insert_aux(iterator __pos, const value_type& __x)
+      {
+       value_type __x_copy = __x; // XXX copy
+#endif
+       difference_type __index = __pos - this->_M_impl._M_start;
+       if (static_cast<size_type>(__index) < size() / 2)
+         {
+           push_front(_GLIBCXX_MOVE(front()));
+           iterator __front1 = this->_M_impl._M_start;
+           ++__front1;
+           iterator __front2 = __front1;
+           ++__front2;
+           __pos = this->_M_impl._M_start + __index;
+           iterator __pos1 = __pos;
+           ++__pos1;
+           _GLIBCXX_MOVE3(__front2, __pos1, __front1);
+         }
+       else
+         {
+           push_back(_GLIBCXX_MOVE(back()));
+           iterator __back1 = this->_M_impl._M_finish;
+           --__back1;
+           iterator __back2 = __back1;
+           --__back2;
+           __pos = this->_M_impl._M_start + __index;
+           _GLIBCXX_MOVE_BACKWARD3(__pos, __back2, __back1);
+         }
+       *__pos = _GLIBCXX_MOVE(__x_copy);
+       return __pos;
+      }
 
   template <typename _Tp, typename _Alloc>
     void
@@ -478,16 +552,16 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
                {
                  iterator __start_n = (this->_M_impl._M_start
                                        + difference_type(__n));
-                 std::__uninitialized_copy_a(this->_M_impl._M_start,
+                 std::__uninitialized_move_a(this->_M_impl._M_start,
                                              __start_n, __new_start,
                                              _M_get_Tp_allocator());
                  this->_M_impl._M_start = __new_start;
-                 std::copy(__start_n, __pos, __old_start);
+                 _GLIBCXX_MOVE3(__start_n, __pos, __old_start);
                  std::fill(__pos - difference_type(__n), __pos, __x_copy);
                }
              else
                {
-                 std::__uninitialized_copy_fill(this->_M_impl._M_start,
+                 std::__uninitialized_move_fill(this->_M_impl._M_start,
                                                 __pos, __new_start,
                                                 this->_M_impl._M_start,
                                                 __x_copy,
@@ -516,17 +590,17 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
                {
                  iterator __finish_n = (this->_M_impl._M_finish
                                         - difference_type(__n));
-                 std::__uninitialized_copy_a(__finish_n,
+                 std::__uninitialized_move_a(__finish_n,
                                              this->_M_impl._M_finish,
                                              this->_M_impl._M_finish,
                                              _M_get_Tp_allocator());
                  this->_M_impl._M_finish = __new_finish;
-                 std::copy_backward(__pos, __finish_n, __old_finish);
+                 _GLIBCXX_MOVE_BACKWARD3(__pos, __finish_n, __old_finish);
                  std::fill(__pos, __pos + difference_type(__n), __x_copy);
                }
              else
                {
-                 std::__uninitialized_fill_copy(this->_M_impl._M_finish,
+                 std::__uninitialized_fill_move(this->_M_impl._M_finish,
                                                 __pos + difference_type(__n),
                                                 __x_copy, __pos,
                                                 this->_M_impl._M_finish,
@@ -565,18 +639,18 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
                  {
                    iterator __start_n = (this->_M_impl._M_start
                                          + difference_type(__n));
-                   std::__uninitialized_copy_a(this->_M_impl._M_start,
+                   std::__uninitialized_move_a(this->_M_impl._M_start,
                                                __start_n, __new_start,
                                                _M_get_Tp_allocator());
                    this->_M_impl._M_start = __new_start;
-                   std::copy(__start_n, __pos, __old_start);
+                   _GLIBCXX_MOVE3(__start_n, __pos, __old_start);
                    std::copy(__first, __last, __pos - difference_type(__n));
                  }
                else
                  {
                    _ForwardIterator __mid = __first;
                    std::advance(__mid, difference_type(__n) - __elemsbefore);
-                   std::__uninitialized_copy_copy(this->_M_impl._M_start,
+                   std::__uninitialized_move_copy(this->_M_impl._M_start,
                                                   __pos, __first, __mid,
                                                   __new_start,
                                                   _M_get_Tp_allocator());
@@ -604,19 +678,19 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
                {
                  iterator __finish_n = (this->_M_impl._M_finish
                                         - difference_type(__n));
-                 std::__uninitialized_copy_a(__finish_n,
+                 std::__uninitialized_move_a(__finish_n,
                                              this->_M_impl._M_finish,
                                              this->_M_impl._M_finish,
                                              _M_get_Tp_allocator());
                  this->_M_impl._M_finish = __new_finish;
-                 std::copy_backward(__pos, __finish_n, __old_finish);
+                 _GLIBCXX_MOVE_BACKWARD3(__pos, __finish_n, __old_finish);
                  std::copy(__first, __last, __pos);
                }
               else
                {
                  _ForwardIterator __mid = __first;
                  std::advance(__mid, __elemsafter);
-                 std::__uninitialized_copy_copy(__mid, __last, __pos,
+                 std::__uninitialized_copy_move(__mid, __last, __pos,
                                                 this->_M_impl._M_finish,
                                                 this->_M_impl._M_finish,
                                                 _M_get_Tp_allocator());
index ae01eae4daeb3d7272649e171c98887afd05045c..a9c6abaf134c4bdd07ab6d98bf26ee8a3c6c8adb 100644 (file)
@@ -1129,6 +1129,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
        *  data to it.  Due to the nature of a %deque this operation
        *  can be done in constant time.
        */
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
       void
       push_front(const value_type& __x)
       {
@@ -1140,6 +1141,21 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
        else
          _M_push_front_aux(__x);
       }
+#else
+      template<typename... _Args>
+        void
+        push_front(_Args&&... __args)
+       {
+         if (this->_M_impl._M_start._M_cur != this->_M_impl._M_start._M_first)
+           {
+             this->_M_impl.construct(this->_M_impl._M_start._M_cur - 1,
+                                     std::forward<_Args>(__args)...);
+             --this->_M_impl._M_start._M_cur;
+           }
+         else
+           _M_push_front_aux(std::forward<_Args>(__args)...);
+       }
+#endif
 
       /**
        *  @brief  Add data to the end of the %deque.
@@ -1150,6 +1166,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
        *  to it.  Due to the nature of a %deque this operation can be
        *  done in constant time.
        */
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
       void
       push_back(const value_type& __x)
       {
@@ -1162,6 +1179,22 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
        else
          _M_push_back_aux(__x);
       }
+#else
+      template<typename... _Args>
+        void
+        push_back(_Args&&... __args)
+       {
+         if (this->_M_impl._M_finish._M_cur
+             != this->_M_impl._M_finish._M_last - 1)
+           {
+             this->_M_impl.construct(this->_M_impl._M_finish._M_cur,
+                                     std::forward<_Args>(__args)...);
+             ++this->_M_impl._M_finish._M_cur;
+           }
+         else
+           _M_push_back_aux(std::forward<_Args>(__args)...);
+       }
+#endif
 
       /**
        *  @brief  Removes first element.
@@ -1205,6 +1238,21 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
          _M_pop_back_aux();
       }
 
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      /**
+       *  @brief  Inserts an object in %deque before specified iterator.
+       *  @param  position  An iterator into the %deque.
+       *  @param  args  Arguments.
+       *  @return  An iterator that points to the inserted data.
+       *
+       *  This function will insert an object of type T constructed
+       *  with T(std::forward<Args>(args)...) before the specified location.
+       */
+      template<typename... _Args>
+        iterator
+        emplace(iterator __position, _Args&&... __args);
+#endif
+
       /**
        *  @brief  Inserts given value into %deque before specified iterator.
        *  @param  position  An iterator into the %deque.
@@ -1217,6 +1265,20 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
       iterator
       insert(iterator __position, const value_type& __x);
 
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      /**
+       *  @brief  Inserts given rvalue into %deque before specified iterator.
+       *  @param  position  An iterator into the %deque.
+       *  @param  x  Data to be inserted.
+       *  @return  An iterator that points to the inserted data.
+       *
+       *  This function will insert a copy of the given rvalue before the
+       *  specified location.
+       */
+      iterator
+      insert(iterator __position, value_type&& __x);
+#endif
+
       /**
        *  @brief  Inserts a number of copies of given data into the %deque.
        *  @param  position  An iterator into the %deque.
@@ -1459,9 +1521,17 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
        *  @brief Helper functions for push_* and pop_*.
        *  @endif
        */
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
       void _M_push_back_aux(const value_type&);
 
       void _M_push_front_aux(const value_type&);
+#else
+      template<typename... _Args>
+        void _M_push_back_aux(_Args&&... __args);
+
+      template<typename... _Args>
+        void _M_push_front_aux(_Args&&... __args);
+#endif
 
       void _M_pop_back_aux();
 
@@ -1512,8 +1582,14 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
       _M_fill_insert(iterator __pos, size_type __n, const value_type& __x);
 
       // called by insert(p,x)
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
       iterator
       _M_insert_aux(iterator __pos, const value_type& __x);
+#else
+      template<typename... _Args>
+        iterator
+        _M_insert_aux(iterator __pos, _Args&&... __args);
+#endif
 
       // called by insert(p,n,x) via fill_insert
       void
index 6f7437aaf10989c2ae8d182c6d66a3f36e9d27a7..88dac3adcb0cbd22f26ba6b15e61c0b0e312eed6 100644 (file)
@@ -323,19 +323,19 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
     { std::uninitialized_fill_n(__first, __n, __x); }
 
 
-  // Extensions: __uninitialized_copy_copy, __uninitialized_copy_fill,
-  // __uninitialized_fill_copy.  All of these algorithms take a user-
-  // supplied allocator, which is used for construction and destruction.
+  // Extensions: __uninitialized_copy_move, __uninitialized_move_copy,
+  // __uninitialized_fill_move, __uninitialized_move_fill.
+  // All of these algorithms take a user-supplied allocator, which is used
+  // for construction and destruction.
 
-  // __uninitialized_copy_copy
+  // __uninitialized_copy_move
   // Copies [first1, last1) into [result, result + (last1 - first1)), and
-  //  copies [first2, last2) into
+  //  move [first2, last2) into
   //  [result, result + (last1 - first1) + (last2 - first2)).
-
   template<typename _InputIterator1, typename _InputIterator2,
           typename _ForwardIterator, typename _Allocator>
     inline _ForwardIterator
-    __uninitialized_copy_copy(_InputIterator1 __first1,
+    __uninitialized_copy_move(_InputIterator1 __first1,
                              _InputIterator1 __last1,
                              _InputIterator2 __first2,
                              _InputIterator2 __last2,
@@ -347,7 +347,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
                                                           __alloc);
       try
        {
-         return std::__uninitialized_copy_a(__first2, __last2, __mid, __alloc);
+         return std::__uninitialized_move_a(__first2, __last2, __mid, __alloc);
        }
       catch(...)
        {
@@ -356,20 +356,48 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
        }
     }
 
-  // __uninitialized_fill_copy
-  // Fills [result, mid) with x, and copies [first, last) into
+  // __uninitialized_move_copy
+  // Moves [first1, last1) into [result, result + (last1 - first1)), and
+  //  copies [first2, last2) into
+  //  [result, result + (last1 - first1) + (last2 - first2)).
+  template<typename _InputIterator1, typename _InputIterator2,
+          typename _ForwardIterator, typename _Allocator>
+    inline _ForwardIterator
+    __uninitialized_move_copy(_InputIterator1 __first1,
+                             _InputIterator1 __last1,
+                             _InputIterator2 __first2,
+                             _InputIterator2 __last2,
+                             _ForwardIterator __result,
+                             _Allocator& __alloc)
+    {
+      _ForwardIterator __mid = std::__uninitialized_move_a(__first1, __last1,
+                                                          __result,
+                                                          __alloc);
+      try
+       {
+         return std::__uninitialized_copy_a(__first2, __last2, __mid, __alloc);
+       }
+      catch(...)
+       {
+         std::_Destroy(__result, __mid, __alloc);
+         __throw_exception_again;
+       }
+    }
+  
+  // __uninitialized_fill_move
+  // Fills [result, mid) with x, and moves [first, last) into
   //  [mid, mid + (last - first)).
   template<typename _ForwardIterator, typename _Tp, typename _InputIterator,
           typename _Allocator>
     inline _ForwardIterator
-    __uninitialized_fill_copy(_ForwardIterator __result, _ForwardIterator __mid,
+    __uninitialized_fill_move(_ForwardIterator __result, _ForwardIterator __mid,
                              const _Tp& __x, _InputIterator __first,
                              _InputIterator __last, _Allocator& __alloc)
     {
       std::__uninitialized_fill_a(__result, __mid, __x, __alloc);
       try
        {
-         return std::__uninitialized_copy_a(__first, __last, __mid, __alloc);
+         return std::__uninitialized_move_a(__first, __last, __mid, __alloc);
        }
       catch(...)
        {
@@ -378,18 +406,18 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
        }
     }
 
-  // __uninitialized_copy_fill
-  // Copies [first1, last1) into [first2, first2 + (last1 - first1)), and
+  // __uninitialized_move_fill
+  // Moves [first1, last1) into [first2, first2 + (last1 - first1)), and
   //  fills [first2 + (last1 - first1), last2) with x.
   template<typename _InputIterator, typename _ForwardIterator, typename _Tp,
           typename _Allocator>
     inline void
-    __uninitialized_copy_fill(_InputIterator __first1, _InputIterator __last1,
+    __uninitialized_move_fill(_InputIterator __first1, _InputIterator __last1,
                              _ForwardIterator __first2,
                              _ForwardIterator __last2, const _Tp& __x,
                              _Allocator& __alloc)
     {
-      _ForwardIterator __mid2 = std::__uninitialized_copy_a(__first1, __last1,
+      _ForwardIterator __mid2 = std::__uninitialized_move_a(__first1, __last1,
                                                            __first2,
                                                            __alloc);
       try
index 8d3bf83f415e8f7ab9f0d8775ff182612c1b569d..c5358f05f35cce4af9076e69bde49748f82bc8c3 100644 (file)
@@ -254,6 +254,7 @@ namespace __debug
       }
 
       // 23.2.1.3 modifiers:
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
       void
       push_front(const _Tp& __x)
       {
@@ -267,6 +268,34 @@ namespace __debug
        _Base::push_back(__x);
        this->_M_invalidate_all();
       }
+#else
+      template<typename... _Args>
+        void
+        push_front(_Args&&... __args)
+       {
+         _Base::push_front(std::forward<_Args>(__args)...);
+         this->_M_invalidate_all();
+       }
+
+      template<typename... _Args>
+        void
+        push_back(_Args&&... __args)
+       {
+         _Base::push_back(std::forward<_Args>(__args)...);
+         this->_M_invalidate_all();
+       }
+
+      template<typename... _Args>
+        iterator
+        emplace(iterator __position, _Args&&... __args)
+       {
+         __glibcxx_check_insert(__position);
+         typename _Base::iterator __res = _Base::emplace(__position.base(),
+                                           std::forward<_Args>(__args)...);
+         this->_M_invalidate_all();
+         return iterator(__res, this);
+       }
+#endif
 
       iterator
       insert(iterator __position, const _Tp& __x)
@@ -277,6 +306,18 @@ namespace __debug
        return iterator(__res, this);
       }
 
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      iterator
+      insert(iterator __position, _Tp&& __x)
+      {
+       __glibcxx_check_insert(__position);
+       typename _Base::iterator __res = _Base::insert(__position.base(),
+                                                      std::move(__x));
+       this->_M_invalidate_all();
+       return iterator(__res, this);
+      }
+#endif
+
       void
       insert(iterator __position, size_type __n, const _Tp& __x)
       {
index 8890ab996be2a7452f4a6cb42cd2f1ec70fefd9d..62cba68c784a6033453d84759cb87f0f5326573a 100644 (file)
@@ -354,7 +354,7 @@ namespace __debug
        bool __realloc = _M_requires_reallocation(this->size() + 1);
        difference_type __offset = __position - begin();
        typename _Base::iterator __res = _Base::insert(__position.base(),
-                                                      std::forward<_Tp>(__x));
+                                                      std::move(__x));
        if (__realloc)
          this->_M_invalidate_all();
        else
index 109ab99eb9fe92599b2fd35f3b2d50a99889d0fd..812e0214c898355e05834f56a1e28ff2713131b4 100644 (file)
@@ -1,4 +1,3 @@
-// { dg-require-rvalref "" }
 // { dg-options "-std=gnu++0x" }
 
 // Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
index 1d93aeb6f791759258a9b04c4f907a5e108de157..6ec082d3d816a7426cdf3239222d9896a32a81a9 100644 (file)
@@ -1,5 +1,4 @@
 // { dg-do compile }
-// { dg-require-rvalref "" }
 // { dg-options "-std=gnu++0x" }
 
 // Copyright (C) 2005, 2007 Free Software Foundation, Inc.
index 605067611d766c14ef232580279badbe43a61b86..c965a9d2449a680402fc3595bce5df12ac142ac2 100644 (file)
@@ -1,4 +1,3 @@
-// { dg-require-rvalref "" }
 // { dg-options "-std=gnu++0x" }
 
 // Copyright (C) 2005, 2007 Free Software Foundation, Inc.
index 929045f040fd3743960346f449903ea8b6fbbe9c..dfc43638087543dcc2ebf1237624b311d9a6079f 100644 (file)
@@ -19,7 +19,7 @@
 // USA.
 
 // { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1402 }
+// { dg-error "no matching" "" { target *-*-* } 1464 }
 // { dg-excess-errors "" }
 
 #include <deque>
index f133b865a7f6ca442a8999eb405089614cd5bcea..0790b5a17f4ae62e3e63430ded6582e7545db161 100644 (file)
@@ -19,7 +19,7 @@
 // USA.
 
 // { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1337 }
+// { dg-error "no matching" "" { target *-*-* } 1399 }
 // { dg-excess-errors "" }
 
 #include <deque>
index a60f922cf311a2fbb11c79a1f33a5c4587bc96ac..2614ba06bb87c2a83c664977b03a9f6afa93e1a0 100644 (file)
@@ -19,7 +19,7 @@
 // USA.
 
 // { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1337 }
+// { dg-error "no matching" "" { target *-*-* } 1399 }
 // { dg-excess-errors "" }
 
 #include <deque>
index 9b8258db5ea67bd2da9d850a4e617ec2c5c52084..a64f1242b2039ca9bdaa7a8c1ad0bd7068d741ca 100644 (file)
@@ -19,7 +19,7 @@
 // USA.
 
 // { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1482 }
+// { dg-error "no matching" "" { target *-*-* } 1552 }
 // { dg-excess-errors "" }
 
 #include <deque>