Deduction guides for the container adaptors - queue, stack, and priority_queue
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@332927 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/stack b/include/stack
index 7b81ade..2b3f8ae 100644
--- a/include/stack
+++ b/include/stack
@@ -61,6 +61,12 @@
void swap(stack& c) noexcept(is_nothrow_swappable_v<Container>)
};
+template<class Container>
+ stack(Container) -> stack<typename Container::value_type, Container>; // C++17
+
+template<class Container, class Allocator>
+ stack(Container, Allocator) -> stack<typename Container::value_type, Container>; // C++17
+
template <class T, class Container>
bool operator==(const stack<T, Container>& x, const stack<T, Container>& y);
template <class T, class Container>
@@ -229,6 +235,22 @@
operator< (const stack<T1, _C1>& __x, const stack<T1, _C1>& __y);
};
+#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
+template<class _Container,
+ class = typename enable_if<!__is_allocator<_Container>::value, nullptr_t>::type
+>
+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
+ >
+stack(_Container, _Alloc)
+ -> stack<typename _Container::value_type, _Container>;
+#endif
+
template <class _Tp, class _Container>
inline _LIBCPP_INLINE_VISIBILITY
bool