]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
forward_list.h (_Fwd_list_node_base<>:: _M_transfer_after, [...]): Move out of line...
authorPaolo Carlini <paolo@gcc.gnu.org>
Wed, 25 Mar 2009 16:41:27 +0000 (16:41 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Wed, 25 Mar 2009 16:41:27 +0000 (16:41 +0000)
2009-03-25  Paolo Carlini  <paolo.carlini@oracle.com>

* include/bits/forward_list.h (_Fwd_list_node_base<>::
_M_transfer_after, _M_reverse_after): Move out of line...
* include/bits/forward_list.tcc: ... here.
(forward_list<>::reverse): Move inline...
* include/bits/forward_list.h: ... here; minor cosmetic changes.

From-SVN: r145069

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/forward_list.h
libstdc++-v3/include/bits/forward_list.tcc

index eebffbded2ba4d08dfdc6aa84bb9c800ad76a339..07ce90f5b8555baa6a85a496a255aa70c3ce6c43 100644 (file)
@@ -1,7 +1,15 @@
+2009-03-25  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       * include/bits/forward_list.h (_Fwd_list_node_base<>::
+       _M_transfer_after, _M_reverse_after): Move out of line...
+       * include/bits/forward_list.tcc: ... here.
+       (forward_list<>::reverse): Move inline...
+       * include/bits/forward_list.h: ... here; minor cosmetic changes.
+
 2009-03-22  Mark Mitchell  <mark@codesourcery.com>
 
-       * testsuite/21_strings/basic_string/inserters_extractors/wchar_t/28277.cc:
-       Likewise.
+       * testsuite/21_strings/basic_string/inserters_extractors/wchar_t/
+       28277.cc: Likewise.
        * testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-3.cc:
        Likewise.
        * testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-4.cc:
index 55029c9647a72a241213df3d26c6e684ddad2391..0a4bf3a6a958ee49be361dfc01a19ed72bcd9291 100644 (file)
@@ -62,52 +62,23 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
         ::other::pointer        _Pointer;
       typedef typename _Alloc::template rebind<_Fwd_list_node_base<_Alloc> >
         ::other::const_pointer  _Const_pointer;
-  
+
       _Pointer _M_next;
-  
+
       _Fwd_list_node_base() : _M_next(0) { }
-  
+
       static void
       swap(_Fwd_list_node_base& __x, _Fwd_list_node_base& __y)
       { std::swap(__x._M_next, __y._M_next); }
-  
+
       void
-      _M_transfer_after(_Pointer __bbegin, _Pointer __bend)
-      { 
-        _Pointer __keep = __bbegin->_M_next;
-        if (__bend)
-          {
-            __bbegin->_M_next = __bend->_M_next;
-            __bend->_M_next = this->_M_next;
-          }
-        else
-          __bbegin->_M_next = 0;
-        this->_M_next = __keep;
-      }
-  
+      _M_transfer_after(_Pointer __bbegin);
+
       void
-      _M_transfer_after(_Pointer __bbegin)
-      {
-        _Pointer __bend = __bbegin;
-        while (__bend && __bend->_M_next)
-          __bend = __bend->_M_next;
-        _M_transfer_after(__bbegin, __bend);
-      }
-  
+      _M_transfer_after(_Pointer __bbegin, _Pointer __bend);
+
       void
-      _M_reverse_after()
-      { 
-        _Pointer __tail = this->_M_next;
-        if (!__tail)
-          return;
-        while (_Pointer __temp = __tail->_M_next)
-          {
-            _Pointer __keep = this->_M_next;
-            this->_M_next = __temp;
-            __tail->_M_next = __temp->_M_next;
-            this->_M_next->_M_next = __keep;
-          }
-      }    
+      _M_reverse_after();
     };
 
   /**
@@ -159,16 +130,16 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
 
       reference
       operator*() const
-      { return __static_pointer_cast<_Node*>(this->_M_node)->_M_value; }
+      { return __static_pointer_cast<_Node*>(_M_node)->_M_value; }
 
       pointer
       operator->() const
-      { return &__static_pointer_cast<_Node*>(this->_M_node)->_M_value; }
+      { return &__static_pointer_cast<_Node*>(_M_node)->_M_value; }
 
       _Self&
       operator++()
       {
-        this->_M_node = this->_M_node->_M_next;
+        _M_node = _M_node->_M_next;
         return *this;
       }
 
@@ -176,23 +147,23 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
       operator++(int)
       {
         _Self __tmp(*this);
-        this->_M_node = this->_M_node->_M_next;
+        _M_node = _M_node->_M_next;
         return __tmp;
       }
 
       bool
       operator==(const _Self& __x) const
-      { return this->_M_node == __x._M_node; }
+      { return _M_node == __x._M_node; }
 
       bool
       operator!=(const _Self& __x) const
-      { return this->_M_node != __x._M_node; }
+      { return _M_node != __x._M_node; }
 
       _Self
       _M_next() const
       {
         if (_M_node)
-          return _Fwd_list_iterator(this->_M_node->_M_next);
+          return _Fwd_list_iterator(_M_node->_M_next);
         else
           return _Fwd_list_iterator(0);
       }
@@ -230,16 +201,16 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
 
       reference
       operator*() const
-      { return __static_pointer_cast<_Node*>(this->_M_node)->_M_value; }
+      { return __static_pointer_cast<_Node*>(_M_node)->_M_value; }
 
       pointer
       operator->() const
-      { return &__static_pointer_cast<_Node*>(this->_M_node)->_M_value; }
+      { return &__static_pointer_cast<_Node*>(_M_node)->_M_value; }
 
       _Self&
       operator++()
       {
-        this->_M_node = this->_M_node->_M_next;
+        _M_node = _M_node->_M_next;
         return *this;
       }
 
@@ -247,23 +218,23 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
       operator++(int)
       {
         _Self __tmp(*this);
-        this->_M_node = this->_M_node->_M_next;
+        _M_node = _M_node->_M_next;
         return __tmp;
       }
 
       bool
       operator==(const _Self& __x) const
-      { return this->_M_node == __x._M_node; }
+      { return _M_node == __x._M_node; }
 
       bool
       operator!=(const _Self& __x) const
-      { return this->_M_node != __x._M_node; }
+      { return _M_node != __x._M_node; }
 
       _Self
       _M_next() const
       {
         if (this->_M_node)
-          return _Fwd_list_const_iterator(this->_M_node->_M_next);
+          return _Fwd_list_const_iterator(_M_node->_M_next);
         else
           return _Fwd_list_const_iterator(0);
       }
@@ -777,7 +748,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
       reference
       front()
       {
-        _Node* __front = __static_pointer_cast<_Node*>(this->_M_impl._M_head._M_next);
+        _Node* __front =
+         __static_pointer_cast<_Node*>(this->_M_impl._M_head._M_next);
         return __front->_M_value;
       }
 
@@ -1229,7 +1201,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
        *  Reverse the order of elements in the list in linear time.
        */
       void
-      reverse();
+      reverse()
+      { this->_M_impl._M_head._M_reverse_after(); }
 
     private:
       template<typename _Integer>
@@ -1328,7 +1301,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   template<typename _Tp, typename _Alloc>
     inline void 
     swap(forward_list<_Tp, _Alloc>& __lx,
-         forward_list<_Tp, _Alloc>&& __ly)
+        forward_list<_Tp, _Alloc>&& __ly)
     { __lx.swap(__ly); }
 
 _GLIBCXX_END_NAMESPACE // namespace std
index bfc814df4a379836a3294a5f1e3dc7010b5560eb..35fb9b30afcb447a2c4f9ac160f380877c347c93 100644 (file)
@@ -1,6 +1,6 @@
 // <forward_list.tcc> -*- C++ -*-
 
-// Copyright (C) 2008 Free Software Foundation, Inc.
+// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
 
 _GLIBCXX_BEGIN_NAMESPACE(std)
 
+  template<typename _Alloc>
+    void
+    _Fwd_list_node_base<_Alloc>::
+    _M_transfer_after(_Pointer __bbegin)
+    {
+      _Pointer __bend = __bbegin;
+      while (__bend && __bend->_M_next)
+       __bend = __bend->_M_next;
+      _M_transfer_after(__bbegin, __bend);
+    }
+
+  template<typename _Alloc>
+    void
+    _Fwd_list_node_base<_Alloc>::
+    _M_transfer_after(_Pointer __bbegin, _Pointer __bend)
+    {
+      _Pointer __keep = __bbegin->_M_next;
+      if (__bend)
+       {
+         __bbegin->_M_next = __bend->_M_next;
+         __bend->_M_next = _M_next;
+       }
+      else
+       __bbegin->_M_next = 0;
+      _M_next = __keep;
+    }
+  template<typename _Alloc>
+    void
+    _Fwd_list_node_base<_Alloc>::
+    _M_reverse_after()
+    {
+      _Pointer __tail = _M_next;
+      if (!__tail)
+       return;
+      while (_Pointer __temp = __tail->_M_next)
+       {
+         _Pointer __keep = _M_next;
+         _M_next = __temp;
+         __tail->_M_next = __temp->_M_next;
+         _M_next->_M_next = __keep;
+       }
+    }
+
  /**
   *  @brief  Sort the singly linked list starting after this node.
   *          This node is assumed to be an empty head node (of type
@@ -411,12 +455,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
           }
       }
 
-  template<typename _Tp, typename _Alloc>
-    void
-    forward_list<_Tp, _Alloc>::
-    reverse()
-    { this->_M_impl._M_head._M_reverse_after(); }
-
   template<typename _Tp, typename _Alloc>
     bool
     operator==(const forward_list<_Tp, _Alloc>& __lx,