[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/queue b/include/queue
index a2048c1..05cc246 100644
--- a/include/queue
+++ b/include/queue
@@ -249,33 +249,28 @@
     template <class _Alloc>
         _LIBCPP_INLINE_VISIBILITY
         explicit queue(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
         queue(const queue& __q, const _Alloc& __a,
-                       typename enable_if<uses_allocator<container_type,
-                                                         _Alloc>::value>::type* = 0)
+                       _EnableIf<uses_allocator<container_type, _Alloc>::value>* = 0)
             : c(__q.c, __a) {}
     template <class _Alloc>
         _LIBCPP_INLINE_VISIBILITY
         queue(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) {}
 #ifndef _LIBCPP_CXX03_LANG
     template <class _Alloc>
         _LIBCPP_INLINE_VISIBILITY
         queue(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
         queue(queue&& __q, 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(__q.c), __a) {}
 
 #endif  // _LIBCPP_CXX03_LANG
@@ -335,15 +330,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>
 >
 queue(_Container)
     -> queue<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>
 >
 queue(_Container, _Alloc)
     -> queue<typename _Container::value_type, _Container>;
@@ -399,10 +394,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(queue<_Tp, _Container>& __x, queue<_Tp, _Container>& __y)
     _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
 {
@@ -486,36 +478,30 @@
     template <class _Alloc>
         _LIBCPP_INLINE_VISIBILITY
         explicit priority_queue(const _Alloc& __a,
-                       typename enable_if<uses_allocator<container_type,
-                                                         _Alloc>::value>::type* = 0);
+                       _EnableIf<uses_allocator<container_type, _Alloc>::value>* = 0);
     template <class _Alloc>
         _LIBCPP_INLINE_VISIBILITY
         priority_queue(const value_compare& __comp, const _Alloc& __a,
-                       typename enable_if<uses_allocator<container_type,
-                                                         _Alloc>::value>::type* = 0);
+                       _EnableIf<uses_allocator<container_type, _Alloc>::value>* = 0);
     template <class _Alloc>
         _LIBCPP_INLINE_VISIBILITY
         priority_queue(const value_compare& __comp, 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);
     template <class _Alloc>
         _LIBCPP_INLINE_VISIBILITY
         priority_queue(const priority_queue& __q, const _Alloc& __a,
-                       typename enable_if<uses_allocator<container_type,
-                                                         _Alloc>::value>::type* = 0);
+                       _EnableIf<uses_allocator<container_type, _Alloc>::value>* = 0);
 #ifndef _LIBCPP_CXX03_LANG
     template <class _Alloc>
         _LIBCPP_INLINE_VISIBILITY
         priority_queue(const value_compare& __comp, 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);
     template <class _Alloc>
         _LIBCPP_INLINE_VISIBILITY
         priority_queue(priority_queue&& __q, const _Alloc& __a,
-                       typename enable_if<uses_allocator<container_type,
-                                                         _Alloc>::value>::type* = 0);
+                       _EnableIf<uses_allocator<container_type, _Alloc>::value>* = 0);
 #endif  // _LIBCPP_CXX03_LANG
 
     _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
@@ -546,28 +532,28 @@
 #ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
 template <class _Compare,
           class _Container,
-          class = typename enable_if<!__is_allocator<_Compare>::value, nullptr_t>::type,
-          class = typename enable_if<!__is_allocator<_Container>::value, nullptr_t>::type
+          class = _EnableIf<!__is_allocator<_Compare>::value>,
+          class = _EnableIf<!__is_allocator<_Container>::value>
 >
 priority_queue(_Compare, _Container)
     -> priority_queue<typename _Container::value_type, _Container, _Compare>;
 
 template<class _InputIterator,
-         class _Compare   = less<typename iterator_traits<_InputIterator>::value_type>,
-         class _Container = vector<typename iterator_traits<_InputIterator>::value_type>,
-         class = typename enable_if< __is_cpp17_input_iterator<_InputIterator>::value, nullptr_t>::type,
-         class = typename enable_if<!__is_allocator<_Compare>::value, nullptr_t>::type,
-         class = typename enable_if<!__is_allocator<_Container>::value, nullptr_t>::type
+         class _Compare = less<__iter_value_type<_InputIterator>>,
+         class _Container = vector<__iter_value_type<_InputIterator>>,
+         class = _EnableIf<__is_cpp17_input_iterator<_InputIterator>::value>,
+         class = _EnableIf<!__is_allocator<_Compare>::value>,
+         class = _EnableIf<!__is_allocator<_Container>::value>
 >
 priority_queue(_InputIterator, _InputIterator, _Compare = _Compare(), _Container = _Container())
-    -> priority_queue<typename iterator_traits<_InputIterator>::value_type, _Container, _Compare>;
+    -> priority_queue<__iter_value_type<_InputIterator>, _Container, _Compare>;
 
 template<class _Compare,
          class _Container,
          class _Alloc,
-         class = typename enable_if<!__is_allocator<_Compare>::value, nullptr_t>::type,
-         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<_Compare>::value>,
+         class = _EnableIf<!__is_allocator<_Container>::value>,
+         class = _EnableIf<__is_allocator<_Alloc>::value>
 >
 priority_queue(_Compare, _Container, _Alloc)
     -> priority_queue<typename _Container::value_type, _Container, _Compare>;
@@ -642,8 +628,7 @@
 template <class _Alloc>
 inline
 priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Alloc& __a,
-                       typename enable_if<uses_allocator<container_type,
-                                                         _Alloc>::value>::type*)
+                       _EnableIf<uses_allocator<container_type, _Alloc>::value>*)
     : c(__a)
 {
 }
@@ -653,8 +638,7 @@
 inline
 priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp,
                                                           const _Alloc& __a,
-                       typename enable_if<uses_allocator<container_type,
-                                                         _Alloc>::value>::type*)
+                       _EnableIf<uses_allocator<container_type, _Alloc>::value>*)
     : c(__a),
       comp(__comp)
 {
@@ -666,8 +650,7 @@
 priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp,
                                                           const container_type& __c,
                                                           const _Alloc& __a,
-                       typename enable_if<uses_allocator<container_type,
-                                                         _Alloc>::value>::type*)
+                       _EnableIf<uses_allocator<container_type, _Alloc>::value>*)
     : c(__c, __a),
       comp(__comp)
 {
@@ -679,8 +662,7 @@
 inline
 priority_queue<_Tp, _Container, _Compare>::priority_queue(const priority_queue& __q,
                                                           const _Alloc& __a,
-                       typename enable_if<uses_allocator<container_type,
-                                                         _Alloc>::value>::type*)
+                       _EnableIf<uses_allocator<container_type, _Alloc>::value>*)
     : c(__q.c, __a),
       comp(__q.comp)
 {
@@ -695,8 +677,7 @@
 priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp,
                                                           container_type&& __c,
                                                           const _Alloc& __a,
-                       typename enable_if<uses_allocator<container_type,
-                                                         _Alloc>::value>::type*)
+                       _EnableIf<uses_allocator<container_type, _Alloc>::value>*)
     : c(_VSTD::move(__c), __a),
       comp(__comp)
 {
@@ -708,8 +689,7 @@
 inline
 priority_queue<_Tp, _Container, _Compare>::priority_queue(priority_queue&& __q,
                                                           const _Alloc& __a,
-                       typename enable_if<uses_allocator<container_type,
-                                                         _Alloc>::value>::type*)
+                       _EnableIf<uses_allocator<container_type, _Alloc>::value>*)
     : c(_VSTD::move(__q.c), __a),
       comp(_VSTD::move(__q.comp))
 {
@@ -773,11 +753,10 @@
 
 template <class _Tp, class _Container, class _Compare>
 inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if<
-    __is_swappable<_Container>::value
-    && __is_swappable<_Compare>::value,
+_EnableIf<
+    __is_swappable<_Container>::value && __is_swappable<_Compare>::value,
     void
->::type
+>
 swap(priority_queue<_Tp, _Container, _Compare>& __x,
      priority_queue<_Tp, _Container, _Compare>& __y)
     _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))