forward_list.h (_Fwd_list_node_base<>:: _M_transfer_after, [...]): Move out of line...
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
This commit is contained in:
parent
e50ea10b75
commit
4ba8a4cb63
|
@ -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>
|
2009-03-22 Mark Mitchell <mark@codesourcery.com>
|
||||||
|
|
||||||
* testsuite/21_strings/basic_string/inserters_extractors/wchar_t/28277.cc:
|
* testsuite/21_strings/basic_string/inserters_extractors/wchar_t/
|
||||||
Likewise.
|
28277.cc: Likewise.
|
||||||
* testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-3.cc:
|
* testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-3.cc:
|
||||||
Likewise.
|
Likewise.
|
||||||
* testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-4.cc:
|
* testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-4.cc:
|
||||||
|
|
|
@ -72,42 +72,13 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
|
||||||
{ std::swap(__x._M_next, __y._M_next); }
|
{ std::swap(__x._M_next, __y._M_next); }
|
||||||
|
|
||||||
void
|
void
|
||||||
_M_transfer_after(_Pointer __bbegin, _Pointer __bend)
|
_M_transfer_after(_Pointer __bbegin);
|
||||||
{
|
|
||||||
_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;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_M_transfer_after(_Pointer __bbegin)
|
_M_transfer_after(_Pointer __bbegin, _Pointer __bend);
|
||||||
{
|
|
||||||
_Pointer __bend = __bbegin;
|
|
||||||
while (__bend && __bend->_M_next)
|
|
||||||
__bend = __bend->_M_next;
|
|
||||||
_M_transfer_after(__bbegin, __bend);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_M_reverse_after()
|
_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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -159,16 +130,16 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
|
||||||
|
|
||||||
reference
|
reference
|
||||||
operator*() const
|
operator*() const
|
||||||
{ return __static_pointer_cast<_Node*>(this->_M_node)->_M_value; }
|
{ return __static_pointer_cast<_Node*>(_M_node)->_M_value; }
|
||||||
|
|
||||||
pointer
|
pointer
|
||||||
operator->() const
|
operator->() const
|
||||||
{ return &__static_pointer_cast<_Node*>(this->_M_node)->_M_value; }
|
{ return &__static_pointer_cast<_Node*>(_M_node)->_M_value; }
|
||||||
|
|
||||||
_Self&
|
_Self&
|
||||||
operator++()
|
operator++()
|
||||||
{
|
{
|
||||||
this->_M_node = this->_M_node->_M_next;
|
_M_node = _M_node->_M_next;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,23 +147,23 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
|
||||||
operator++(int)
|
operator++(int)
|
||||||
{
|
{
|
||||||
_Self __tmp(*this);
|
_Self __tmp(*this);
|
||||||
this->_M_node = this->_M_node->_M_next;
|
_M_node = _M_node->_M_next;
|
||||||
return __tmp;
|
return __tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
operator==(const _Self& __x) const
|
operator==(const _Self& __x) const
|
||||||
{ return this->_M_node == __x._M_node; }
|
{ return _M_node == __x._M_node; }
|
||||||
|
|
||||||
bool
|
bool
|
||||||
operator!=(const _Self& __x) const
|
operator!=(const _Self& __x) const
|
||||||
{ return this->_M_node != __x._M_node; }
|
{ return _M_node != __x._M_node; }
|
||||||
|
|
||||||
_Self
|
_Self
|
||||||
_M_next() const
|
_M_next() const
|
||||||
{
|
{
|
||||||
if (_M_node)
|
if (_M_node)
|
||||||
return _Fwd_list_iterator(this->_M_node->_M_next);
|
return _Fwd_list_iterator(_M_node->_M_next);
|
||||||
else
|
else
|
||||||
return _Fwd_list_iterator(0);
|
return _Fwd_list_iterator(0);
|
||||||
}
|
}
|
||||||
|
@ -230,16 +201,16 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
|
||||||
|
|
||||||
reference
|
reference
|
||||||
operator*() const
|
operator*() const
|
||||||
{ return __static_pointer_cast<_Node*>(this->_M_node)->_M_value; }
|
{ return __static_pointer_cast<_Node*>(_M_node)->_M_value; }
|
||||||
|
|
||||||
pointer
|
pointer
|
||||||
operator->() const
|
operator->() const
|
||||||
{ return &__static_pointer_cast<_Node*>(this->_M_node)->_M_value; }
|
{ return &__static_pointer_cast<_Node*>(_M_node)->_M_value; }
|
||||||
|
|
||||||
_Self&
|
_Self&
|
||||||
operator++()
|
operator++()
|
||||||
{
|
{
|
||||||
this->_M_node = this->_M_node->_M_next;
|
_M_node = _M_node->_M_next;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,23 +218,23 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
|
||||||
operator++(int)
|
operator++(int)
|
||||||
{
|
{
|
||||||
_Self __tmp(*this);
|
_Self __tmp(*this);
|
||||||
this->_M_node = this->_M_node->_M_next;
|
_M_node = _M_node->_M_next;
|
||||||
return __tmp;
|
return __tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
operator==(const _Self& __x) const
|
operator==(const _Self& __x) const
|
||||||
{ return this->_M_node == __x._M_node; }
|
{ return _M_node == __x._M_node; }
|
||||||
|
|
||||||
bool
|
bool
|
||||||
operator!=(const _Self& __x) const
|
operator!=(const _Self& __x) const
|
||||||
{ return this->_M_node != __x._M_node; }
|
{ return _M_node != __x._M_node; }
|
||||||
|
|
||||||
_Self
|
_Self
|
||||||
_M_next() const
|
_M_next() const
|
||||||
{
|
{
|
||||||
if (this->_M_node)
|
if (this->_M_node)
|
||||||
return _Fwd_list_const_iterator(this->_M_node->_M_next);
|
return _Fwd_list_const_iterator(_M_node->_M_next);
|
||||||
else
|
else
|
||||||
return _Fwd_list_const_iterator(0);
|
return _Fwd_list_const_iterator(0);
|
||||||
}
|
}
|
||||||
|
@ -777,7 +748,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
|
||||||
reference
|
reference
|
||||||
front()
|
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;
|
return __front->_M_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1229,7 +1201,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
|
||||||
* Reverse the order of elements in the list in linear time.
|
* Reverse the order of elements in the list in linear time.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
reverse();
|
reverse()
|
||||||
|
{ this->_M_impl._M_head._M_reverse_after(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template<typename _Integer>
|
template<typename _Integer>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// <forward_list.tcc> -*- C++ -*-
|
// <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
|
// 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
|
// software; you can redistribute it and/or modify it under the
|
||||||
|
@ -36,6 +36,50 @@
|
||||||
|
|
||||||
_GLIBCXX_BEGIN_NAMESPACE(std)
|
_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.
|
* @brief Sort the singly linked list starting after this node.
|
||||||
* This node is assumed to be an empty head node (of type
|
* 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>
|
template<typename _Tp, typename _Alloc>
|
||||||
bool
|
bool
|
||||||
operator==(const forward_list<_Tp, _Alloc>& __lx,
|
operator==(const forward_list<_Tp, _Alloc>& __lx,
|
||||||
|
|
Loading…
Reference in New Issue