[libc++] Use _EnableIf and __iter_value_type consistently. NFCI.
Specifically, use these metafunctions consistently in areas that are
about to be affected by P1518R2's changes.
This is the NFCI part of https://reviews.llvm.org/D97742 .
The functional-change part is still waiting for P1518R2 to be
officially merged into the working draft.
GitOrigin-RevId: 199d2ebeed8382071809983f016e482b1d013b62
diff --git a/include/stack b/include/stack
index 2a2b350..ff97e2e 100644
--- a/include/stack
+++ b/include/stack
@@ -156,33 +156,28 @@
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
@@ -236,15 +231,15 @@
#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<__is_allocator<_Alloc>::value>
>
stack(_Container, _Alloc)
-> stack<typename _Container::value_type, _Container>;
@@ -300,10 +295,7 @@
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)))
{