aboutsummaryrefslogtreecommitdiff
path: root/libcxx/include/stack
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/include/stack')
-rw-r--r--libcxx/include/stack36
1 files changed, 15 insertions, 21 deletions
diff --git a/libcxx/include/stack b/libcxx/include/stack
index 2a2b350386e5..aefef31ac97b 100644
--- a/libcxx/include/stack
+++ b/libcxx/include/stack
@@ -88,6 +88,8 @@ template <class T, class Container>
*/
#include <__config>
+#include <__memory/uses_allocator.h>
+#include <__utility/forward.h>
#include <deque>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -148,7 +150,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
explicit stack(container_type&& __c) : c(_VSTD::move(__c)) {}
-#endif // _LIBCPP_CXX03_LANG
+#endif // _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
explicit stack(const container_type& __c) : c(__c) {}
@@ -156,35 +158,30 @@ public:
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
explicit stack(const _Alloc& __a,
- typename enable_if<uses_allocator<container_type,
- _Alloc>::value>::type* = 0)
+ _EnableIf<uses_allocator<container_type, _Alloc>::value>* = 0)
: c(__a) {}
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
stack(const container_type& __c, const _Alloc& __a,
- typename enable_if<uses_allocator<container_type,
- _Alloc>::value>::type* = 0)
+ _EnableIf<uses_allocator<container_type, _Alloc>::value>* = 0)
: c(__c, __a) {}
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
stack(const stack& __s, const _Alloc& __a,
- typename enable_if<uses_allocator<container_type,
- _Alloc>::value>::type* = 0)
+ _EnableIf<uses_allocator<container_type, _Alloc>::value>* = 0)
: c(__s.c, __a) {}
#ifndef _LIBCPP_CXX03_LANG
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
stack(container_type&& __c, const _Alloc& __a,
- typename enable_if<uses_allocator<container_type,
- _Alloc>::value>::type* = 0)
+ _EnableIf<uses_allocator<container_type, _Alloc>::value>* = 0)
: c(_VSTD::move(__c), __a) {}
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
stack(stack&& __s, const _Alloc& __a,
- typename enable_if<uses_allocator<container_type,
- _Alloc>::value>::type* = 0)
+ _EnableIf<uses_allocator<container_type, _Alloc>::value>* = 0)
: c(_VSTD::move(__s.c), __a) {}
-#endif // _LIBCPP_CXX03_LANG
+#endif // _LIBCPP_CXX03_LANG
_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
bool empty() const {return c.empty();}
@@ -210,7 +207,7 @@ public:
void emplace(_Args&&... __args)
{ c.emplace_back(_VSTD::forward<_Args>(__args)...);}
#endif
-#endif // _LIBCPP_CXX03_LANG
+#endif // _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
void pop() {c.pop_back();}
@@ -236,15 +233,15 @@ public:
#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
template<class _Container,
- class = typename enable_if<!__is_allocator<_Container>::value, nullptr_t>::type
+ class = _EnableIf<!__is_allocator<_Container>::value>
>
stack(_Container)
-> stack<typename _Container::value_type, _Container>;
template<class _Container,
class _Alloc,
- class = typename enable_if<!__is_allocator<_Container>::value, nullptr_t>::type,
- class = typename enable_if< __is_allocator<_Alloc>::value, nullptr_t>::type
+ class = _EnableIf<!__is_allocator<_Container>::value>,
+ class = _EnableIf<uses_allocator<_Container, _Alloc>::value>
>
stack(_Container, _Alloc)
-> stack<typename _Container::value_type, _Container>;
@@ -300,10 +297,7 @@ operator<=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
template <class _Tp, class _Container>
inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if<
- __is_swappable<_Container>::value,
- void
->::type
+_EnableIf<__is_swappable<_Container>::value, void>
swap(stack<_Tp, _Container>& __x, stack<_Tp, _Container>& __y)
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
{
@@ -318,4 +312,4 @@ struct _LIBCPP_TEMPLATE_VIS uses_allocator<stack<_Tp, _Container>, _Alloc>
_LIBCPP_END_NAMESPACE_STD
-#endif // _LIBCPP_STACK
+#endif // _LIBCPP_STACK