re PR libstdc++/25191 (exception_defines.h #defines try/catch)
[gcc.git] / libstdc++-v3 / include / ext / slist
index fb886d8a7b9b87bdf09b556be03dc8d1f7b1eb5e..ea6c3c076e950c1f3aa1afcecf3d33bcbd7be1a2 100644 (file)
@@ -1,6 +1,7 @@
 // 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
@@ -15,7 +16,7 @@
 
 // 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
   {
@@ -190,6 +193,7 @@ namespace __gnu_cxx
       typedef _Ref             reference;
       typedef _Slist_node<_Tp> _Node;
 
+      explicit
       _Slist_iterator(_Node* __x)
       : _Slist_iterator_base(__x) {}
 
@@ -324,12 +328,12 @@ namespace __gnu_cxx
       _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;
@@ -341,12 +345,12 @@ namespace __gnu_cxx
       _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;
@@ -403,7 +407,7 @@ namespace __gnu_cxx
         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());
        }
 
@@ -526,7 +530,7 @@ namespace __gnu_cxx
         _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());
        }
 
@@ -601,20 +605,26 @@ namespace __gnu_cxx
 
       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);
 
@@ -1016,13 +1026,12 @@ namespace __gnu_cxx
          }
       }
 
-} // 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> >
     {
@@ -1066,7 +1075,8 @@ namespace std
       insert_iterator<_Container>&
       operator++(int)
       { return *this; }
-};
+    };
+
+_GLIBCXX_END_NAMESPACE
 
-} // namespace std
 #endif