[libcxx-commits] [libcxx] 199d2eb - [libc++] Use _EnableIf and __iter_value_type consistently. NFCI.

Arthur O'Dwyer via libcxx-commits libcxx-commits at lists.llvm.org
Mon Mar 29 06:23:06 PDT 2021


Author: Arthur O'Dwyer
Date: 2021-03-29T09:22:52-04:00
New Revision: 199d2ebeed8382071809983f016e482b1d013b62

URL: https://github.com/llvm/llvm-project/commit/199d2ebeed8382071809983f016e482b1d013b62
DIFF: https://github.com/llvm/llvm-project/commit/199d2ebeed8382071809983f016e482b1d013b62.diff

LOG: [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.

Added: 
    

Modified: 
    libcxx/include/deque
    libcxx/include/forward_list
    libcxx/include/list
    libcxx/include/queue
    libcxx/include/set
    libcxx/include/stack
    libcxx/include/string
    libcxx/include/vector

Removed: 
    


################################################################################
diff  --git a/libcxx/include/deque b/libcxx/include/deque
index c6517d170f34..429dcabeacd7 100644
--- a/libcxx/include/deque
+++ b/libcxx/include/deque
@@ -1586,18 +1586,18 @@ public:
 
 #ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
 template<class _InputIterator,
-         class _Alloc = allocator<typename iterator_traits<_InputIterator>::value_type>,
-         class = typename enable_if<__is_allocator<_Alloc>::value, void>::type
+         class _Alloc = allocator<__iter_value_type<_InputIterator>>,
+         class = _EnableIf<__is_allocator<_Alloc>::value>
          >
 deque(_InputIterator, _InputIterator)
-  -> deque<typename iterator_traits<_InputIterator>::value_type, _Alloc>;
+  -> deque<__iter_value_type<_InputIterator>, _Alloc>;
 
 template<class _InputIterator,
          class _Alloc,
-         class = typename enable_if<__is_allocator<_Alloc>::value, void>::type
+         class = _EnableIf<__is_allocator<_Alloc>::value>
          >
 deque(_InputIterator, _InputIterator, _Alloc)
-  -> deque<typename iterator_traits<_InputIterator>::value_type, _Alloc>;
+  -> deque<__iter_value_type<_InputIterator>, _Alloc>;
 #endif
 
 

diff  --git a/libcxx/include/forward_list b/libcxx/include/forward_list
index d3d6b8238f6b..42eff0b706ae 100644
--- a/libcxx/include/forward_list
+++ b/libcxx/include/forward_list
@@ -871,18 +871,18 @@ private:
 
 #ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
 template<class _InputIterator,
-         class _Alloc = allocator<typename iterator_traits<_InputIterator>::value_type>,
-         class = typename enable_if<__is_allocator<_Alloc>::value, void>::type
+         class _Alloc = allocator<__iter_value_type<_InputIterator>>,
+         class = _EnableIf<__is_allocator<_Alloc>::value>
          >
 forward_list(_InputIterator, _InputIterator)
-  -> forward_list<typename iterator_traits<_InputIterator>::value_type, _Alloc>;
+  -> forward_list<__iter_value_type<_InputIterator>, _Alloc>;
 
 template<class _InputIterator,
          class _Alloc,
-         class = typename enable_if<__is_allocator<_Alloc>::value, void>::type
+         class = _EnableIf<__is_allocator<_Alloc>::value>
          >
 forward_list(_InputIterator, _InputIterator, _Alloc)
-  -> forward_list<typename iterator_traits<_InputIterator>::value_type, _Alloc>;
+  -> forward_list<__iter_value_type<_InputIterator>, _Alloc>;
 #endif
 
 template <class _Tp, class _Alloc>

diff  --git a/libcxx/include/list b/libcxx/include/list
index a18514d74eaf..cfb28e86f9f2 100644
--- a/libcxx/include/list
+++ b/libcxx/include/list
@@ -1144,18 +1144,18 @@ private:
 
 #ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
 template<class _InputIterator,
-         class _Alloc = allocator<typename iterator_traits<_InputIterator>::value_type>,
-         class = typename enable_if<__is_allocator<_Alloc>::value, void>::type
+         class _Alloc = allocator<__iter_value_type<_InputIterator>>,
+         class = _EnableIf<__is_allocator<_Alloc>::value>
          >
 list(_InputIterator, _InputIterator)
-  -> list<typename iterator_traits<_InputIterator>::value_type, _Alloc>;
+  -> list<__iter_value_type<_InputIterator>, _Alloc>;
 
 template<class _InputIterator,
          class _Alloc,
-         class = typename enable_if<__is_allocator<_Alloc>::value, void>::type
+         class = _EnableIf<__is_allocator<_Alloc>::value>
          >
 list(_InputIterator, _InputIterator, _Alloc)
-  -> list<typename iterator_traits<_InputIterator>::value_type, _Alloc>;
+  -> list<__iter_value_type<_InputIterator>, _Alloc>;
 #endif
 
 // Link in nodes [__f, __l] just prior to __p

diff  --git a/libcxx/include/queue b/libcxx/include/queue
index a2048c1e22cc..05cc2466baa4 100644
--- a/libcxx/include/queue
+++ b/libcxx/include/queue
@@ -249,33 +249,28 @@ public:
     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 @@ public:
 
 #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 @@ operator<=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
 
 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 @@ public:
     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 @@ public:
 #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 _Tp, class _Container, class _Compare>
 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 @@ template <class _Alloc>
 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 @@ inline
 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 @@ template <class _Alloc>
 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 @@ inline
 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 @@ template <class _Alloc>
 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 @@ priority_queue<_Tp, _Container, _Compare>::swap(priority_queue& __q)
 
 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)))

diff  --git a/libcxx/include/set b/libcxx/include/set
index 506a5d5af395..a5cf39995f2d 100644
--- a/libcxx/include/set
+++ b/libcxx/include/set
@@ -853,12 +853,12 @@ public:
 
 #ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
 template<class _InputIterator,
-         class _Compare = less<typename iterator_traits<_InputIterator>::value_type>,
-         class _Allocator = allocator<typename iterator_traits<_InputIterator>::value_type>,
+         class _Compare = less<__iter_value_type<_InputIterator>>,
+         class _Allocator = allocator<__iter_value_type<_InputIterator>>,
          class = _EnableIf<__is_allocator<_Allocator>::value, void>,
          class = _EnableIf<!__is_allocator<_Compare>::value, void>>
 set(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator())
-  -> set<typename iterator_traits<_InputIterator>::value_type, _Compare, _Allocator>;
+  -> set<__iter_value_type<_InputIterator>, _Compare, _Allocator>;
 
 template<class _Key, class _Compare = less<_Key>,
          class _Allocator = allocator<_Key>,
@@ -870,8 +870,8 @@ set(initializer_list<_Key>, _Compare = _Compare(), _Allocator = _Allocator())
 template<class _InputIterator, class _Allocator,
          class = _EnableIf<__is_allocator<_Allocator>::value, void>>
 set(_InputIterator, _InputIterator, _Allocator)
-  -> set<typename iterator_traits<_InputIterator>::value_type,
-         less<typename iterator_traits<_InputIterator>::value_type>, _Allocator>;
+  -> set<__iter_value_type<_InputIterator>,
+         less<__iter_value_type<_InputIterator>>, _Allocator>;
 
 template<class _Key, class _Allocator,
          class = _EnableIf<__is_allocator<_Allocator>::value, void>>
@@ -1380,12 +1380,12 @@ public:
 
 #ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
 template<class _InputIterator,
-         class _Compare = less<typename iterator_traits<_InputIterator>::value_type>,
-         class _Allocator = allocator<typename iterator_traits<_InputIterator>::value_type>,
+         class _Compare = less<__iter_value_type<_InputIterator>>,
+         class _Allocator = allocator<__iter_value_type<_InputIterator>>,
          class = _EnableIf<__is_allocator<_Allocator>::value, void>,
          class = _EnableIf<!__is_allocator<_Compare>::value, void>>
 multiset(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator())
-  -> multiset<typename iterator_traits<_InputIterator>::value_type, _Compare, _Allocator>;
+  -> multiset<__iter_value_type<_InputIterator>, _Compare, _Allocator>;
 
 template<class _Key, class _Compare = less<_Key>,
          class _Allocator = allocator<_Key>,
@@ -1397,8 +1397,8 @@ multiset(initializer_list<_Key>, _Compare = _Compare(), _Allocator = _Allocator(
 template<class _InputIterator, class _Allocator,
          class = _EnableIf<__is_allocator<_Allocator>::value, void>>
 multiset(_InputIterator, _InputIterator, _Allocator)
-  -> multiset<typename iterator_traits<_InputIterator>::value_type,
-         less<typename iterator_traits<_InputIterator>::value_type>, _Allocator>;
+  -> multiset<__iter_value_type<_InputIterator>,
+         less<__iter_value_type<_InputIterator>>, _Allocator>;
 
 template<class _Key, class _Allocator,
          class = _EnableIf<__is_allocator<_Allocator>::value, void>>

diff  --git a/libcxx/include/stack b/libcxx/include/stack
index 2a2b350386e5..ff97e2e43e56 100644
--- a/libcxx/include/stack
+++ b/libcxx/include/stack
@@ -156,33 +156,28 @@ public:
     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 @@ public:
 
 #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 @@ operator<=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
 
 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)))
 {

diff  --git a/libcxx/include/string b/libcxx/include/string
index a5fe62572349..5f49b4774e8b 100644
--- a/libcxx/include/string
+++ b/libcxx/include/string
@@ -1740,7 +1740,7 @@ _LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE, wchar_t)
 
 #ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
 template<class _InputIterator,
-         class _CharT = typename iterator_traits<_InputIterator>::value_type,
+         class _CharT = __iter_value_type<_InputIterator>,
          class _Allocator = allocator<_CharT>,
          class = _EnableIf<__is_cpp17_input_iterator<_InputIterator>::value>,
          class = _EnableIf<__is_allocator<_Allocator>::value>

diff  --git a/libcxx/include/vector b/libcxx/include/vector
index 8e2df79f9284..4e1a46af2f4b 100644
--- a/libcxx/include/vector
+++ b/libcxx/include/vector
@@ -931,18 +931,18 @@ private:
 
 #ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
 template<class _InputIterator,
-         class _Alloc = allocator<typename iterator_traits<_InputIterator>::value_type>,
-         class = typename enable_if<__is_allocator<_Alloc>::value, void>::type
+         class _Alloc = allocator<__iter_value_type<_InputIterator>>,
+         class = _EnableIf<__is_allocator<_Alloc>::value>
          >
 vector(_InputIterator, _InputIterator)
-  -> vector<typename iterator_traits<_InputIterator>::value_type, _Alloc>;
+  -> vector<__iter_value_type<_InputIterator>, _Alloc>;
 
 template<class _InputIterator,
          class _Alloc,
-         class = typename enable_if<__is_allocator<_Alloc>::value, void>::type
+         class = _EnableIf<__is_allocator<_Alloc>::value>
          >
 vector(_InputIterator, _InputIterator, _Alloc)
-  -> vector<typename iterator_traits<_InputIterator>::value_type, _Alloc>;
+  -> vector<__iter_value_type<_InputIterator>, _Alloc>;
 #endif
 
 template <class _Tp, class _Allocator>


        


More information about the libcxx-commits mailing list