1*e4b17023SJohn Marino // Compatibility symbols for previous versions, list bits -*- C++ -*- 2*e4b17023SJohn Marino 3*e4b17023SJohn Marino // Copyright (C) 2011, 2012 Free Software Foundation, Inc. 4*e4b17023SJohn Marino // 5*e4b17023SJohn Marino // This file is part of the GNU ISO C++ Library. This library is free 6*e4b17023SJohn Marino // software; you can redistribute it and/or modify it under the 7*e4b17023SJohn Marino // terms of the GNU General Public License as published by the 8*e4b17023SJohn Marino // Free Software Foundation; either version 3, or (at your option) 9*e4b17023SJohn Marino // any later version. 10*e4b17023SJohn Marino 11*e4b17023SJohn Marino // This library is distributed in the hope that it will be useful, 12*e4b17023SJohn Marino // but WITHOUT ANY WARRANTY; without even the implied warranty of 13*e4b17023SJohn Marino // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14*e4b17023SJohn Marino // GNU General Public License for more details. 15*e4b17023SJohn Marino 16*e4b17023SJohn Marino // Under Section 7 of GPL version 3, you are granted additional 17*e4b17023SJohn Marino // permissions described in the GCC Runtime Library Exception, version 18*e4b17023SJohn Marino // 3.1, as published by the Free Software Foundation. 19*e4b17023SJohn Marino 20*e4b17023SJohn Marino // You should have received a copy of the GNU General Public License and 21*e4b17023SJohn Marino // a copy of the GCC Runtime Library Exception along with this program; 22*e4b17023SJohn Marino // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23*e4b17023SJohn Marino // <http://www.gnu.org/licenses/>. 24*e4b17023SJohn Marino 25*e4b17023SJohn Marino #include <bits/move.h> 26*e4b17023SJohn Marino 27*e4b17023SJohn Marino #ifdef PIC 28*e4b17023SJohn Marino 29*e4b17023SJohn Marino #ifndef _GLIBCXX_BEGIN_NAMESPACE_COMPAT 30*e4b17023SJohn Marino # define _GLIBCXX_BEGIN_NAMESPACE_COMPAT 31*e4b17023SJohn Marino #endif 32*e4b17023SJohn Marino 33*e4b17023SJohn Marino #ifndef _GLIBCXX_END_NAMESPACE_COMPAT 34*e4b17023SJohn Marino # define _GLIBCXX_END_NAMESPACE_COMPAT 35*e4b17023SJohn Marino #endif 36*e4b17023SJohn Marino 37*e4b17023SJohn Marino namespace std _GLIBCXX_VISIBILITY(default) 38*e4b17023SJohn Marino { 39*e4b17023SJohn Marino _GLIBCXX_BEGIN_NAMESPACE_COMPAT 40*e4b17023SJohn Marino 41*e4b17023SJohn Marino struct _List_node_base 42*e4b17023SJohn Marino { 43*e4b17023SJohn Marino _List_node_base* _M_next; 44*e4b17023SJohn Marino _List_node_base* _M_prev; 45*e4b17023SJohn Marino 46*e4b17023SJohn Marino void 47*e4b17023SJohn Marino _M_transfer(_List_node_base * const __first, 48*e4b17023SJohn Marino _List_node_base * const __last) _GLIBCXX_USE_NOEXCEPT; 49*e4b17023SJohn Marino 50*e4b17023SJohn Marino void 51*e4b17023SJohn Marino _M_reverse() _GLIBCXX_USE_NOEXCEPT; 52*e4b17023SJohn Marino 53*e4b17023SJohn Marino void 54*e4b17023SJohn Marino _M_hook(_List_node_base * const __position) _GLIBCXX_USE_NOEXCEPT; 55*e4b17023SJohn Marino 56*e4b17023SJohn Marino void 57*e4b17023SJohn Marino _M_unhook() _GLIBCXX_USE_NOEXCEPT; 58*e4b17023SJohn Marino }; 59*e4b17023SJohn Marino 60*e4b17023SJohn Marino void 61*e4b17023SJohn Marino _List_node_base:: 62*e4b17023SJohn Marino _M_transfer(_List_node_base * const __first, 63*e4b17023SJohn Marino _List_node_base * const __last) _GLIBCXX_USE_NOEXCEPT 64*e4b17023SJohn Marino { 65*e4b17023SJohn Marino if (this != __last) 66*e4b17023SJohn Marino { 67*e4b17023SJohn Marino // Remove [first, last) from its old position. 68*e4b17023SJohn Marino __last->_M_prev->_M_next = this; 69*e4b17023SJohn Marino __first->_M_prev->_M_next = __last; 70*e4b17023SJohn Marino this->_M_prev->_M_next = __first; 71*e4b17023SJohn Marino 72*e4b17023SJohn Marino // Splice [first, last) into its new position. 73*e4b17023SJohn Marino _List_node_base* const __tmp = this->_M_prev; 74*e4b17023SJohn Marino this->_M_prev = __last->_M_prev; 75*e4b17023SJohn Marino __last->_M_prev = __first->_M_prev; 76*e4b17023SJohn Marino __first->_M_prev = __tmp; 77*e4b17023SJohn Marino } 78*e4b17023SJohn Marino } 79*e4b17023SJohn Marino 80*e4b17023SJohn Marino void 81*e4b17023SJohn Marino _List_node_base::_M_reverse() _GLIBCXX_USE_NOEXCEPT 82*e4b17023SJohn Marino { 83*e4b17023SJohn Marino _List_node_base* __tmp = this; 84*e4b17023SJohn Marino do 85*e4b17023SJohn Marino { 86*e4b17023SJohn Marino std::swap(__tmp->_M_next, __tmp->_M_prev); 87*e4b17023SJohn Marino 88*e4b17023SJohn Marino // Old next node is now prev. 89*e4b17023SJohn Marino __tmp = __tmp->_M_prev; 90*e4b17023SJohn Marino } 91*e4b17023SJohn Marino while (__tmp != this); 92*e4b17023SJohn Marino } 93*e4b17023SJohn Marino 94*e4b17023SJohn Marino void 95*e4b17023SJohn Marino _List_node_base:: 96*e4b17023SJohn Marino _M_hook(_List_node_base* const __position) _GLIBCXX_USE_NOEXCEPT 97*e4b17023SJohn Marino { 98*e4b17023SJohn Marino this->_M_next = __position; 99*e4b17023SJohn Marino this->_M_prev = __position->_M_prev; 100*e4b17023SJohn Marino __position->_M_prev->_M_next = this; 101*e4b17023SJohn Marino __position->_M_prev = this; 102*e4b17023SJohn Marino } 103*e4b17023SJohn Marino 104*e4b17023SJohn Marino void 105*e4b17023SJohn Marino _List_node_base::_M_unhook() _GLIBCXX_USE_NOEXCEPT 106*e4b17023SJohn Marino { 107*e4b17023SJohn Marino _List_node_base* const __next_node = this->_M_next; 108*e4b17023SJohn Marino _List_node_base* const __prev_node = this->_M_prev; 109*e4b17023SJohn Marino __prev_node->_M_next = __next_node; 110*e4b17023SJohn Marino __next_node->_M_prev = __prev_node; 111*e4b17023SJohn Marino } 112*e4b17023SJohn Marino 113*e4b17023SJohn Marino _GLIBCXX_END_NAMESPACE_COMPAT 114*e4b17023SJohn Marino 115*e4b17023SJohn Marino } // namespace std 116*e4b17023SJohn Marino 117*e4b17023SJohn Marino #endif 118