1 // Compatibility symbols for previous versions, list bits -*- C++ -*-
3 // Copyright (C) 2010 Free Software Foundation, Inc.
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 3, or (at your option)
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // Under Section 7 of GPL version 3, you are granted additional
17 // permissions described in the GCC Runtime Library Exception, version
18 // 3.1, as published by the Free Software Foundation.
20 // You should have received a copy of the GNU General Public License and
21 // a copy of the GCC Runtime Library Exception along with this program;
22 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23 // <http://www.gnu.org/licenses/>.
25 #include <bits/move.h>
27 _GLIBCXX_BEGIN_NESTED_NAMESPACE(std
, _GLIBCXX_STD_D
)
29 struct _List_node_base
31 _List_node_base
* _M_next
;
32 _List_node_base
* _M_prev
;
35 transfer(_List_node_base
* const __first
,
36 _List_node_base
* const __last
) throw ();
42 hook(_List_node_base
* const __position
) throw ();
49 _List_node_base::transfer(_List_node_base
* const __first
,
50 _List_node_base
* const __last
) throw ()
54 // Remove [first, last) from its old position.
55 __last
->_M_prev
->_M_next
= this;
56 __first
->_M_prev
->_M_next
= __last
;
57 this->_M_prev
->_M_next
= __first
;
59 // Splice [first, last) into its new position.
60 _List_node_base
* const __tmp
= this->_M_prev
;
61 this->_M_prev
= __last
->_M_prev
;
62 __last
->_M_prev
= __first
->_M_prev
;
63 __first
->_M_prev
= __tmp
;
68 _List_node_base::reverse() throw ()
70 _List_node_base
* __tmp
= this;
73 std::swap(__tmp
->_M_next
, __tmp
->_M_prev
);
75 // Old next node is now prev.
76 __tmp
= __tmp
->_M_prev
;
78 while (__tmp
!= this);
82 _List_node_base::hook(_List_node_base
* const __position
) throw ()
84 this->_M_next
= __position
;
85 this->_M_prev
= __position
->_M_prev
;
86 __position
->_M_prev
->_M_next
= this;
87 __position
->_M_prev
= this;
91 _List_node_base::unhook() throw ()
93 _List_node_base
* const __next_node
= this->_M_next
;
94 _List_node_base
* const __prev_node
= this->_M_prev
;
95 __prev_node
->_M_next
= __next_node
;
96 __next_node
->_M_prev
= __prev_node
;
99 _GLIBCXX_END_NESTED_NAMESPACE