|
@@ -92,7 +92,7 @@ bool
|
|
operator< (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y);
|
|
operator< (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y);
|
|
|
|
|
|
template <class _Tp, class _Container = deque<_Tp> >
|
|
template <class _Tp, class _Container = deque<_Tp> >
|
|
-class stack
|
|
|
|
|
|
+class _LIBCPP_VISIBLE stack
|
|
{
|
|
{
|
|
public:
|
|
public:
|
|
typedef _Container container_type;
|
|
typedef _Container container_type;
|
|
@@ -105,56 +105,76 @@ protected:
|
|
container_type c;
|
|
container_type c;
|
|
|
|
|
|
public:
|
|
public:
|
|
|
|
+ _LIBCPP_INLINE_VISIBILITY
|
|
stack() : c() {}
|
|
stack() : c() {}
|
|
|
|
+ _LIBCPP_INLINE_VISIBILITY
|
|
explicit stack(const container_type& __c) : c(__c) {}
|
|
explicit stack(const container_type& __c) : c(__c) {}
|
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
|
|
|
+ _LIBCPP_INLINE_VISIBILITY
|
|
explicit stack(container_type&& __c) : c(_STD::move(__c)) {}
|
|
explicit stack(container_type&& __c) : c(_STD::move(__c)) {}
|
|
|
|
+ _LIBCPP_INLINE_VISIBILITY
|
|
stack(stack&& __s) : c(_STD::move(__s.c)) {}
|
|
stack(stack&& __s) : c(_STD::move(__s.c)) {}
|
|
|
|
+ _LIBCPP_INLINE_VISIBILITY
|
|
stack& operator=(stack&& __s) {c = _STD::move(__s.c); return *this;}
|
|
stack& operator=(stack&& __s) {c = _STD::move(__s.c); return *this;}
|
|
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
|
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
|
template <class _Alloc>
|
|
template <class _Alloc>
|
|
|
|
+ _LIBCPP_INLINE_VISIBILITY
|
|
explicit stack(const _Alloc& __a,
|
|
explicit stack(const _Alloc& __a,
|
|
typename enable_if<uses_allocator<container_type,
|
|
typename enable_if<uses_allocator<container_type,
|
|
_Alloc>::value>::type* = 0)
|
|
_Alloc>::value>::type* = 0)
|
|
: c(__a) {}
|
|
: c(__a) {}
|
|
template <class _Alloc>
|
|
template <class _Alloc>
|
|
|
|
+ _LIBCPP_INLINE_VISIBILITY
|
|
stack(const container_type& __c, const _Alloc& __a,
|
|
stack(const container_type& __c, const _Alloc& __a,
|
|
typename enable_if<uses_allocator<container_type,
|
|
typename enable_if<uses_allocator<container_type,
|
|
_Alloc>::value>::type* = 0)
|
|
_Alloc>::value>::type* = 0)
|
|
: c(__c, __a) {}
|
|
: c(__c, __a) {}
|
|
template <class _Alloc>
|
|
template <class _Alloc>
|
|
|
|
+ _LIBCPP_INLINE_VISIBILITY
|
|
stack(const stack& __s, const _Alloc& __a,
|
|
stack(const stack& __s, const _Alloc& __a,
|
|
typename enable_if<uses_allocator<container_type,
|
|
typename enable_if<uses_allocator<container_type,
|
|
_Alloc>::value>::type* = 0)
|
|
_Alloc>::value>::type* = 0)
|
|
: c(__s.c, __a) {}
|
|
: c(__s.c, __a) {}
|
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
|
template <class _Alloc>
|
|
template <class _Alloc>
|
|
|
|
+ _LIBCPP_INLINE_VISIBILITY
|
|
stack(container_type&& __c, const _Alloc& __a,
|
|
stack(container_type&& __c, const _Alloc& __a,
|
|
typename enable_if<uses_allocator<container_type,
|
|
typename enable_if<uses_allocator<container_type,
|
|
_Alloc>::value>::type* = 0)
|
|
_Alloc>::value>::type* = 0)
|
|
: c(_STD::move(__c), __a) {}
|
|
: c(_STD::move(__c), __a) {}
|
|
template <class _Alloc>
|
|
template <class _Alloc>
|
|
|
|
+ _LIBCPP_INLINE_VISIBILITY
|
|
stack(stack&& __s, const _Alloc& __a,
|
|
stack(stack&& __s, const _Alloc& __a,
|
|
typename enable_if<uses_allocator<container_type,
|
|
typename enable_if<uses_allocator<container_type,
|
|
_Alloc>::value>::type* = 0)
|
|
_Alloc>::value>::type* = 0)
|
|
: c(_STD::move(__s.c), __a) {}
|
|
: c(_STD::move(__s.c), __a) {}
|
|
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
|
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
|
|
|
|
|
|
|
+ _LIBCPP_INLINE_VISIBILITY
|
|
bool empty() const {return c.empty();}
|
|
bool empty() const {return c.empty();}
|
|
|
|
+ _LIBCPP_INLINE_VISIBILITY
|
|
size_type size() const {return c.size();}
|
|
size_type size() const {return c.size();}
|
|
|
|
+ _LIBCPP_INLINE_VISIBILITY
|
|
reference top() {return c.back();}
|
|
reference top() {return c.back();}
|
|
|
|
+ _LIBCPP_INLINE_VISIBILITY
|
|
const_reference top() const {return c.back();}
|
|
const_reference top() const {return c.back();}
|
|
|
|
|
|
|
|
+ _LIBCPP_INLINE_VISIBILITY
|
|
void push(const value_type& __v) {c.push_back(__v);}
|
|
void push(const value_type& __v) {c.push_back(__v);}
|
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
|
|
|
+ _LIBCPP_INLINE_VISIBILITY
|
|
void push(value_type&& __v) {c.push_back(_STD::move(__v));}
|
|
void push(value_type&& __v) {c.push_back(_STD::move(__v));}
|
|
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
|
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
|
- template <class... _Args> void emplace(_Args&&... __args)
|
|
|
|
|
|
+ template <class... _Args>
|
|
|
|
+ _LIBCPP_INLINE_VISIBILITY
|
|
|
|
+ void emplace(_Args&&... __args)
|
|
{c.emplace_back(_STD::forward<_Args>(__args)...);}
|
|
{c.emplace_back(_STD::forward<_Args>(__args)...);}
|
|
#endif // _LIBCPP_HAS_NO_VARIADICS
|
|
#endif // _LIBCPP_HAS_NO_VARIADICS
|
|
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
|
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
|
|
|
+ _LIBCPP_INLINE_VISIBILITY
|
|
void pop() {c.pop_back();}
|
|
void pop() {c.pop_back();}
|
|
|
|
|
|
|
|
+ _LIBCPP_INLINE_VISIBILITY
|
|
void swap(stack& __s)
|
|
void swap(stack& __s)
|
|
{
|
|
{
|
|
using _STD::swap;
|
|
using _STD::swap;
|
|
@@ -173,7 +193,7 @@ public:
|
|
};
|
|
};
|
|
|
|
|
|
template <class _Tp, class _Container>
|
|
template <class _Tp, class _Container>
|
|
-inline
|
|
|
|
|
|
+inline _LIBCPP_INLINE_VISIBILITY
|
|
bool
|
|
bool
|
|
operator==(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
|
operator==(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
|
{
|
|
{
|
|
@@ -181,7 +201,7 @@ operator==(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
|
}
|
|
}
|
|
|
|
|
|
template <class _Tp, class _Container>
|
|
template <class _Tp, class _Container>
|
|
-inline
|
|
|
|
|
|
+inline _LIBCPP_INLINE_VISIBILITY
|
|
bool
|
|
bool
|
|
operator< (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
|
operator< (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
|
{
|
|
{
|
|
@@ -189,7 +209,7 @@ operator< (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
|
}
|
|
}
|
|
|
|
|
|
template <class _Tp, class _Container>
|
|
template <class _Tp, class _Container>
|
|
-inline
|
|
|
|
|
|
+inline _LIBCPP_INLINE_VISIBILITY
|
|
bool
|
|
bool
|
|
operator!=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
|
operator!=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
|
{
|
|
{
|
|
@@ -197,7 +217,7 @@ operator!=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
|
}
|
|
}
|
|
|
|
|
|
template <class _Tp, class _Container>
|
|
template <class _Tp, class _Container>
|
|
-inline
|
|
|
|
|
|
+inline _LIBCPP_INLINE_VISIBILITY
|
|
bool
|
|
bool
|
|
operator> (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
|
operator> (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
|
{
|
|
{
|
|
@@ -205,7 +225,7 @@ operator> (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
|
}
|
|
}
|
|
|
|
|
|
template <class _Tp, class _Container>
|
|
template <class _Tp, class _Container>
|
|
-inline
|
|
|
|
|
|
+inline _LIBCPP_INLINE_VISIBILITY
|
|
bool
|
|
bool
|
|
operator>=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
|
operator>=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
|
{
|
|
{
|
|
@@ -213,7 +233,7 @@ operator>=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
|
}
|
|
}
|
|
|
|
|
|
template <class _Tp, class _Container>
|
|
template <class _Tp, class _Container>
|
|
-inline
|
|
|
|
|
|
+inline _LIBCPP_INLINE_VISIBILITY
|
|
bool
|
|
bool
|
|
operator<=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
|
operator<=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
|
{
|
|
{
|
|
@@ -221,7 +241,7 @@ operator<=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
|
|
}
|
|
}
|
|
|
|
|
|
template <class _Tp, class _Container>
|
|
template <class _Tp, class _Container>
|
|
-inline
|
|
|
|
|
|
+inline _LIBCPP_INLINE_VISIBILITY
|
|
void
|
|
void
|
|
swap(stack<_Tp, _Container>& __x, stack<_Tp, _Container>& __y)
|
|
swap(stack<_Tp, _Container>& __x, stack<_Tp, _Container>& __y)
|
|
{
|
|
{
|
|
@@ -229,7 +249,7 @@ swap(stack<_Tp, _Container>& __x, stack<_Tp, _Container>& __y)
|
|
}
|
|
}
|
|
|
|
|
|
template <class _Tp, class _Container, class _Alloc>
|
|
template <class _Tp, class _Container, class _Alloc>
|
|
-struct uses_allocator<stack<_Tp, _Container>, _Alloc>
|
|
|
|
|
|
+struct _LIBCPP_VISIBLE uses_allocator<stack<_Tp, _Container>, _Alloc>
|
|
: public uses_allocator<_Container, _Alloc>
|
|
: public uses_allocator<_Container, _Alloc>
|
|
{
|
|
{
|
|
};
|
|
};
|