Use aliases for type traits in C++14 mode.
[gcc.git] / libstdc++-v3 / include / bits / stl_stack.h
index 7312a35e9ded4753774cd34213dc8f337382e0ae..f4bb72c3891ae327a76867140dc9bd37610ba7be 100644 (file)
@@ -1,7 +1,6 @@
 // Stack implementation -*- C++ -*-
 
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
-// Free Software Foundation, Inc.
+// Copyright (C) 2001-2014 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
@@ -49,9 +48,9 @@
  * purpose.  It is provided "as is" without express or implied warranty.
  */
 
-/** @file stl_stack.h
+/** @file bits/stl_stack.h
  *  This is an internal header file, included by other library headers.
- *  You should not attempt to use it directly.
+ *  Do not attempt to use it directly. @headername{stack}
  */
 
 #ifndef _STL_STACK_H
 
 #include <bits/concept_check.h>
 #include <debug/debug.h>
+#if __cplusplus >= 201103L
+# include <bits/uses_allocator.h>
+#endif
 
-_GLIBCXX_BEGIN_NAMESPACE(std)
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   /**
    *  @brief  A standard container giving FILO behavior.
    *
    *  @ingroup sequences
    *
+   *  @tparam _Tp  Type of element.
+   *  @tparam _Sequence  Type of underlying sequence, defaults to deque<_Tp>.
+   *
    *  Meets many of the requirements of a
    *  <a href="tables.html#65">container</a>,
    *  but does not define anything to do with iterators.  Very few of the
@@ -121,7 +128,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
       /**
        *  @brief  Default constructor creates no elements.
        */
-#ifndef __GXX_EXPERIMENTAL_CXX0X__
+#if __cplusplus < 201103L
       explicit
       stack(const _Sequence& __c = _Sequence())
       : c(__c) { }
@@ -171,7 +178,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
 
       /**
        *  @brief  Add data to the top of the %stack.
-       *  @param  x  Data to be added.
+       *  @param  __x  Data to be added.
        *
        *  This is a typical %stack operation.  The function creates an
        *  element at the top of the %stack and assigns the given data
@@ -182,7 +189,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
       push(const value_type& __x)
       { c.push_back(__x); }
 
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
+#if __cplusplus >= 201103L
       void
       push(value_type&& __x)
       { c.push_back(std::move(__x)); }
@@ -211,17 +218,21 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
        c.pop_back();
       }
 
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
+#if __cplusplus >= 201103L
       void
       swap(stack& __s)
-      { c.swap(__s.c); }
+      noexcept(noexcept(swap(c, __s.c)))
+      {
+       using std::swap;
+       swap(c, __s.c);
+      }
 #endif
     };
 
   /**
    *  @brief  Stack equality comparison.
-   *  @param  x  A %stack.
-   *  @param  y  A %stack of the same type as @a x.
+   *  @param  __x  A %stack.
+   *  @param  __y  A %stack of the same type as @a __x.
    *  @return  True iff the size and elements of the stacks are equal.
    *
    *  This is an equivalence relation.  Complexity and semantics
@@ -237,9 +248,9 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
 
   /**
    *  @brief  Stack ordering relation.
-   *  @param  x  A %stack.
-   *  @param  y  A %stack of the same type as @a x.
-   *  @return  True iff @a x is lexicographically less than @a y.
+   *  @param  __x  A %stack.
+   *  @param  __y  A %stack of the same type as @a x.
+   *  @return  True iff @a x is lexicographically less than @a __y.
    *
    *  This is an total ordering relation.  Complexity and semantics
    *  depend on the underlying sequence type, but the expected rules
@@ -277,10 +288,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
     operator>=(const stack<_Tp, _Seq>& __x, const stack<_Tp, _Seq>& __y)
     { return !(__x < __y); }
 
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
+#if __cplusplus >= 201103L
   template<typename _Tp, typename _Seq>
     inline void
     swap(stack<_Tp, _Seq>& __x, stack<_Tp, _Seq>& __y)
+    noexcept(noexcept(__x.swap(__y)))
     { __x.swap(__y); }
 
   template<typename _Tp, typename _Seq, typename _Alloc>
@@ -288,6 +300,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
     : public uses_allocator<_Seq, _Alloc>::type { };
 #endif
 
-_GLIBCXX_END_NAMESPACE
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
 
 #endif /* _STL_STACK_H */