summaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2009-03-25 16:41:27 +0000
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2009-03-25 16:41:27 +0000
commit9f9522aaad717596c4ddfdea8e52c53333668e53 (patch)
tree7d2fcdb350b0f6921419cc102bfb328fc49480a9 /libstdc++-v3
parent665c5290db83d62b5872b54bfe06829d79de137d (diff)
downloadgcc-9f9522aaad717596c4ddfdea8e52c53333668e53.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@145069 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog12
-rw-r--r--libstdc++-v3/include/bits/forward_list.h83
-rw-r--r--libstdc++-v3/include/bits/forward_list.tcc52
3 files changed, 83 insertions, 64 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index eebffbded2b..07ce90f5b85 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -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:
diff --git a/libstdc++-v3/include/bits/forward_list.h b/libstdc++-v3/include/bits/forward_list.h
index 55029c9647a..0a4bf3a6a95 100644
--- a/libstdc++-v3/include/bits/forward_list.h
+++ b/libstdc++-v3/include/bits/forward_list.h
@@ -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
diff --git a/libstdc++-v3/include/bits/forward_list.tcc b/libstdc++-v3/include/bits/forward_list.tcc
index bfc814df4a3..35fb9b30afc 100644
--- a/libstdc++-v3/include/bits/forward_list.tcc
+++ b/libstdc++-v3/include/bits/forward_list.tcc
@@ -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
@@ -36,6 +36,50 @@
_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
@@ -412,12 +456,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,
const forward_list<_Tp, _Alloc>& __ly)