Deduction guides for the container adaptors - queue, stack, and priority_queue
llvm-svn: 332927
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: 5b8b8b5dce587f1e5a4a31cc24f09b18bd53ff9a
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