summaryrefslogtreecommitdiff
path: root/include/stack
diff options
context:
space:
mode:
Diffstat (limited to 'include/stack')
-rw-r--r--include/stack10
1 files changed, 7 insertions, 3 deletions
diff --git a/include/stack b/include/stack
index 2992b091ee51c..48b3b0d16ec2f 100644
--- a/include/stack
+++ b/include/stack
@@ -58,7 +58,7 @@ public:
template <class... Args> void emplace(Args&&... args);
void pop();
- void swap(stack& c) noexcept(noexcept(swap(c, q.c)));
+ void swap(stack& c) noexcept(is_nothrow_swappable_v<Container>)
};
template <class T, class Container>
@@ -112,7 +112,8 @@ public:
typedef typename container_type::reference reference;
typedef typename container_type::const_reference const_reference;
typedef typename container_type::size_type size_type;
-
+ static_assert((is_same<_Tp, value_type>::value), "" );
+
protected:
container_type c;
@@ -274,7 +275,10 @@ operator<=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
template <class _Tp, class _Container>
inline _LIBCPP_INLINE_VISIBILITY
-void
+typename enable_if<
+ __is_swappable<_Container>::value,
+ void
+>::type
swap(stack<_Tp, _Container>& __x, stack<_Tp, _Container>& __y)
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
{