// Singly-linked list implementation -*- C++ -*-
-// Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2004, 2005, 2007, 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
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
// USA.
// As a special exception, you may use this file as part of a free software
#ifndef _SLIST
#define _SLIST 1
-#include <bits/stl_algobase.h>
+#include <algorithm>
#include <bits/allocator.h>
#include <bits/stl_construct.h>
#include <bits/stl_uninitialized.h>
#include <bits/concept_check.h>
-namespace __gnu_cxx
-{
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
using std::size_t;
using std::ptrdiff_t;
using std::_Construct;
using std::_Destroy;
using std::allocator;
+ using std::__true_type;
+ using std::__false_type;
struct _Slist_node_base
{
typedef _Ref reference;
typedef _Slist_node<_Tp> _Node;
+ explicit
_Slist_iterator(_Node* __x)
: _Slist_iterator_base(__x) {}
_M_create_node(const value_type& __x)
{
_Node* __node = this->_M_get_node();
- try
+ __try
{
get_allocator().construct(&__node->_M_data, __x);
__node->_M_next = 0;
}
- catch(...)
+ __catch(...)
{
this->_M_put_node(__node);
__throw_exception_again;
_M_create_node()
{
_Node* __node = this->_M_get_node();
- try
+ __try
{
get_allocator().construct(&__node->_M_data, value_type());
__node->_M_next = 0;
}
- catch(...)
+ __catch(...)
{
this->_M_put_node(__node);
__throw_exception_again;
void
assign(_InputIterator __first, _InputIterator __last)
{
- typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
+ typedef typename std::__is_integer<_InputIterator>::__type _Integral;
_M_assign_dispatch(__first, __last, _Integral());
}
_M_insert_after_range(_Node_base* __pos,
_InIterator __first, _InIterator __last)
{
- typedef typename _Is_integer<_InIterator>::_Integral _Integral;
+ typedef typename std::__is_integer<_InIterator>::__type _Integral;
_M_insert_after_range(__pos, __first, __last, _Integral());
}
iterator
erase_after(iterator __before_first, iterator __last)
- { return iterator((_Node*) this->_M_erase_after(__before_first._M_node,
- __last._M_node)); }
+ {
+ return iterator((_Node*) this->_M_erase_after(__before_first._M_node,
+ __last._M_node));
+ }
iterator
erase(iterator __pos)
- { return (_Node*) this->_M_erase_after(__slist_previous(&this->_M_head,
- __pos._M_node)); }
+ {
+ return iterator((_Node*) this->_M_erase_after
+ (__slist_previous(&this->_M_head, __pos._M_node)));
+ }
iterator
erase(iterator __first, iterator __last)
- { return (_Node*) this->_M_erase_after(__slist_previous(&this->_M_head,
- __first._M_node),
- __last._M_node); }
-
+ {
+ return iterator((_Node*) this->_M_erase_after
+ (__slist_previous(&this->_M_head, __first._M_node),
+ __last._M_node));
+ }
+
void
resize(size_type new_size, const _Tp& __x);
}
}
-} // namespace __gnu_cxx
+_GLIBCXX_END_NAMESPACE
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
-namespace std
-{
// Specialization of insert_iterator so that insertions will be constant
// time rather than linear time.
-
template <class _Tp, class _Alloc>
class insert_iterator<__gnu_cxx::slist<_Tp, _Alloc> >
{
insert_iterator<_Container>&
operator++(int)
{ return *this; }
-};
+ };
+
+_GLIBCXX_END_NAMESPACE
-} // namespace std
#endif