[libcxx-commits] [libcxx] 4e0ea2c - [libc++] Use enable_if_t instead of _EnableIf
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Sep 8 06:09:40 PDT 2021
Author: Louis Dionne
Date: 2021-09-08T09:09:28-04:00
New Revision: 4e0ea2cf2e7c5f04c526f5476eff70280f3c0871
URL: https://github.com/llvm/llvm-project/commit/4e0ea2cf2e7c5f04c526f5476eff70280f3c0871
DIFF: https://github.com/llvm/llvm-project/commit/4e0ea2cf2e7c5f04c526f5476eff70280f3c0871.diff
LOG: [libc++] Use enable_if_t instead of _EnableIf
I just ran into a compiler error involving __bind_back and some overloads
that were being disabled with _EnableIf. I noticed that the error message
was quite bad and did not mention the reason for the overload being
excluded. Specifically, the error looked like this:
candidate template ignored: substitution failure [with _Args =
<ContiguousView>]: no member named '_EnableIfImpl' in 'std::_MetaBase<false>'
Instead, when using enable_if or enable_if_t, the compiler is clever and
can produce better diagnostics, like so:
candidate template ignored: requirement 'is_invocable_v<
std::__bind_back_op<1, std::integer_sequence<unsigned long, 0>>,
std::ranges::views::__transform::__fn &, std::tuple<PlusOne> &,
ContiguousView>' was not satisfied [with _Args = <ContiguousView>]
Basically, it tries to do a poor man's implementation of concepts, which
is already a lot better than simply complaining about substitution failure.
Hence, this commit uses enable_if_t instead of _EnableIf whenever
possible. That is both more straightforward than using the internal
helper, and also leads to better error messages in those cases.
I understand the motivation for _EnableIf's implementation was to improve
compile-time performance, however I believe striving to improve error
messages is even more important for our QOI, hence this patch. Furthermore,
it is unclear that _EnableIf actually improved compile-time performance
in any noticeable way (see discussion in the review for details).
Differential Revision: https://reviews.llvm.org/D108216
Added:
Modified:
libcxx/include/__functional/bind_back.h
libcxx/include/__functional/bind_front.h
libcxx/include/__functional/not_fn.h
libcxx/include/__functional/perfect_forward.h
libcxx/include/__memory/construct_at.h
libcxx/include/array
libcxx/include/bit
libcxx/include/cmath
libcxx/include/deque
libcxx/include/forward_list
libcxx/include/list
libcxx/include/map
libcxx/include/optional
libcxx/include/queue
libcxx/include/set
libcxx/include/stack
libcxx/include/string
libcxx/include/type_traits
libcxx/include/unordered_map
libcxx/include/unordered_set
libcxx/include/vector
Removed:
################################################################################
diff --git a/libcxx/include/__functional/bind_back.h b/libcxx/include/__functional/bind_back.h
index 2af990d168de6..a0089e1fb090b 100644
--- a/libcxx/include/__functional/bind_back.h
+++ b/libcxx/include/__functional/bind_back.h
@@ -44,7 +44,7 @@ struct __bind_back_t : __perfect_forward<__bind_back_op<tuple_size_v<_BoundArgs>
using __perfect_forward<__bind_back_op<tuple_size_v<_BoundArgs>>, _Fn, _BoundArgs>::__perfect_forward;
};
-template <class _Fn, class ..._Args, class = _EnableIf<
+template <class _Fn, class ..._Args, class = enable_if_t<
_And<
is_constructible<decay_t<_Fn>, _Fn>,
is_move_constructible<decay_t<_Fn>>,
diff --git a/libcxx/include/__functional/bind_front.h b/libcxx/include/__functional/bind_front.h
index 331dec6779265..86d4594b6571a 100644
--- a/libcxx/include/__functional/bind_front.h
+++ b/libcxx/include/__functional/bind_front.h
@@ -38,7 +38,7 @@ struct __bind_front_t : __perfect_forward<__bind_front_op, _Fn, _BoundArgs...> {
using __perfect_forward<__bind_front_op, _Fn, _BoundArgs...>::__perfect_forward;
};
-template <class _Fn, class... _Args, class = _EnableIf<
+template <class _Fn, class... _Args, class = enable_if_t<
_And<
is_constructible<decay_t<_Fn>, _Fn>,
is_move_constructible<decay_t<_Fn>>,
diff --git a/libcxx/include/__functional/not_fn.h b/libcxx/include/__functional/not_fn.h
index 98701fe6eb8c5..81fe112c88bad 100644
--- a/libcxx/include/__functional/not_fn.h
+++ b/libcxx/include/__functional/not_fn.h
@@ -37,7 +37,7 @@ struct __not_fn_t : __perfect_forward<__not_fn_op, _Fn> {
using __perfect_forward<__not_fn_op, _Fn>::__perfect_forward;
};
-template <class _Fn, class = _EnableIf<
+template <class _Fn, class = enable_if_t<
is_constructible_v<decay_t<_Fn>, _Fn> &&
is_move_constructible_v<decay_t<_Fn>>
>>
diff --git a/libcxx/include/__functional/perfect_forward.h b/libcxx/include/__functional/perfect_forward.h
index 9b456f0cc0f3d..308b304a76dc0 100644
--- a/libcxx/include/__functional/perfect_forward.h
+++ b/libcxx/include/__functional/perfect_forward.h
@@ -34,7 +34,7 @@ struct __perfect_forward_impl<_Op, index_sequence<_Idx...>, _Bound...> {
tuple<_Bound...> __bound_;
public:
- template <class ..._BoundArgs, class = _EnableIf<
+ template <class ..._BoundArgs, class = enable_if_t<
is_constructible_v<tuple<_Bound...>, _BoundArgs&&...>
>>
explicit constexpr __perfect_forward_impl(_BoundArgs&& ...__bound)
@@ -47,40 +47,40 @@ struct __perfect_forward_impl<_Op, index_sequence<_Idx...>, _Bound...> {
__perfect_forward_impl& operator=(__perfect_forward_impl const&) = default;
__perfect_forward_impl& operator=(__perfect_forward_impl&&) = default;
- template <class ..._Args, class = _EnableIf<is_invocable_v<_Op, _Bound&..., _Args...>>>
+ template <class ..._Args, class = enable_if_t<is_invocable_v<_Op, _Bound&..., _Args...>>>
_LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) &
noexcept(noexcept(_Op()(_VSTD::get<_Idx>(__bound_)..., _VSTD::forward<_Args>(__args)...)))
-> decltype( _Op()(_VSTD::get<_Idx>(__bound_)..., _VSTD::forward<_Args>(__args)...))
{ return _Op()(_VSTD::get<_Idx>(__bound_)..., _VSTD::forward<_Args>(__args)...); }
- template <class ..._Args, class = _EnableIf<!is_invocable_v<_Op, _Bound&..., _Args...>>>
+ template <class ..._Args, class = enable_if_t<!is_invocable_v<_Op, _Bound&..., _Args...>>>
auto operator()(_Args&&...) & = delete;
- template <class ..._Args, class = _EnableIf<is_invocable_v<_Op, _Bound const&..., _Args...>>>
+ template <class ..._Args, class = enable_if_t<is_invocable_v<_Op, _Bound const&..., _Args...>>>
_LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) const&
noexcept(noexcept(_Op()(_VSTD::get<_Idx>(__bound_)..., _VSTD::forward<_Args>(__args)...)))
-> decltype( _Op()(_VSTD::get<_Idx>(__bound_)..., _VSTD::forward<_Args>(__args)...))
{ return _Op()(_VSTD::get<_Idx>(__bound_)..., _VSTD::forward<_Args>(__args)...); }
- template <class ..._Args, class = _EnableIf<!is_invocable_v<_Op, _Bound const&..., _Args...>>>
+ template <class ..._Args, class = enable_if_t<!is_invocable_v<_Op, _Bound const&..., _Args...>>>
auto operator()(_Args&&...) const& = delete;
- template <class ..._Args, class = _EnableIf<is_invocable_v<_Op, _Bound..., _Args...>>>
+ template <class ..._Args, class = enable_if_t<is_invocable_v<_Op, _Bound..., _Args...>>>
_LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) &&
noexcept(noexcept(_Op()(_VSTD::get<_Idx>(_VSTD::move(__bound_))..., _VSTD::forward<_Args>(__args)...)))
-> decltype( _Op()(_VSTD::get<_Idx>(_VSTD::move(__bound_))..., _VSTD::forward<_Args>(__args)...))
{ return _Op()(_VSTD::get<_Idx>(_VSTD::move(__bound_))..., _VSTD::forward<_Args>(__args)...); }
- template <class ..._Args, class = _EnableIf<!is_invocable_v<_Op, _Bound..., _Args...>>>
+ template <class ..._Args, class = enable_if_t<!is_invocable_v<_Op, _Bound..., _Args...>>>
auto operator()(_Args&&...) && = delete;
- template <class ..._Args, class = _EnableIf<is_invocable_v<_Op, _Bound const..., _Args...>>>
+ template <class ..._Args, class = enable_if_t<is_invocable_v<_Op, _Bound const..., _Args...>>>
_LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Args&&... __args) const&&
noexcept(noexcept(_Op()(_VSTD::get<_Idx>(_VSTD::move(__bound_))..., _VSTD::forward<_Args>(__args)...)))
-> decltype( _Op()(_VSTD::get<_Idx>(_VSTD::move(__bound_))..., _VSTD::forward<_Args>(__args)...))
{ return _Op()(_VSTD::get<_Idx>(_VSTD::move(__bound_))..., _VSTD::forward<_Args>(__args)...); }
- template <class ..._Args, class = _EnableIf<!is_invocable_v<_Op, _Bound const..., _Args...>>>
+ template <class ..._Args, class = enable_if_t<!is_invocable_v<_Op, _Bound const..., _Args...>>>
auto operator()(_Args&&...) const&& = delete;
};
diff --git a/libcxx/include/__memory/construct_at.h b/libcxx/include/__memory/construct_at.h
index 4018db982da8a..789677d7a6139 100644
--- a/libcxx/include/__memory/construct_at.h
+++ b/libcxx/include/__memory/construct_at.h
@@ -47,7 +47,7 @@ template <class _ForwardIterator>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17
void destroy(_ForwardIterator, _ForwardIterator);
-template <class _Tp, _EnableIf<!is_array_v<_Tp>, int> = 0>
+template <class _Tp, enable_if_t<!is_array_v<_Tp>, int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17
void destroy_at(_Tp* __loc) {
_LIBCPP_ASSERT(__loc, "null pointer given to destroy_at");
@@ -55,7 +55,7 @@ void destroy_at(_Tp* __loc) {
}
#if _LIBCPP_STD_VER > 17
-template <class _Tp, _EnableIf<is_array_v<_Tp>, int> = 0>
+template <class _Tp, enable_if_t<is_array_v<_Tp>, int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX17
void destroy_at(_Tp* __loc) {
_LIBCPP_ASSERT(__loc, "null pointer given to destroy_at");
diff --git a/libcxx/include/array b/libcxx/include/array
index b76b9fa9a2f09..0ddfc955af9f0 100644
--- a/libcxx/include/array
+++ b/libcxx/include/array
@@ -358,7 +358,7 @@ struct _LIBCPP_TEMPLATE_VIS array<_Tp, 0>
#if _LIBCPP_STD_VER >= 17
template<class _Tp, class... _Args,
- class = _EnableIf<__all<_IsSame<_Tp, _Args>::value...>::value>
+ class = enable_if_t<__all<_IsSame<_Tp, _Args>::value...>::value>
>
array(_Tp, _Args...)
-> array<_Tp, 1 + sizeof...(_Args)>;
diff --git a/libcxx/include/bit b/libcxx/include/bit
index c64e45c5fa302..168cdd97beb97 100644
--- a/libcxx/include/bit
+++ b/libcxx/include/bit
@@ -222,7 +222,7 @@ bool __has_single_bit(_Tp __t) _NOEXCEPT
template<class _Tp>
_LIBCPP_INLINE_VISIBILITY constexpr
-_EnableIf<__libcpp_is_unsigned_integer<_Tp>::value, _Tp>
+enable_if_t<__libcpp_is_unsigned_integer<_Tp>::value, _Tp>
rotl(_Tp __t, unsigned int __cnt) noexcept
{
return __rotl(__t, __cnt);
@@ -230,7 +230,7 @@ rotl(_Tp __t, unsigned int __cnt) noexcept
template<class _Tp>
_LIBCPP_INLINE_VISIBILITY constexpr
-_EnableIf<__libcpp_is_unsigned_integer<_Tp>::value, _Tp>
+enable_if_t<__libcpp_is_unsigned_integer<_Tp>::value, _Tp>
rotr(_Tp __t, unsigned int __cnt) noexcept
{
return __rotr(__t, __cnt);
@@ -238,7 +238,7 @@ rotr(_Tp __t, unsigned int __cnt) noexcept
template<class _Tp>
_LIBCPP_INLINE_VISIBILITY constexpr
-_EnableIf<__libcpp_is_unsigned_integer<_Tp>::value, int>
+enable_if_t<__libcpp_is_unsigned_integer<_Tp>::value, int>
countl_zero(_Tp __t) noexcept
{
return __countl_zero(__t);
@@ -246,7 +246,7 @@ countl_zero(_Tp __t) noexcept
template<class _Tp>
_LIBCPP_INLINE_VISIBILITY constexpr
-_EnableIf<__libcpp_is_unsigned_integer<_Tp>::value, int>
+enable_if_t<__libcpp_is_unsigned_integer<_Tp>::value, int>
countl_one(_Tp __t) noexcept
{
return __countl_one(__t);
@@ -254,7 +254,7 @@ countl_one(_Tp __t) noexcept
template<class _Tp>
_LIBCPP_INLINE_VISIBILITY constexpr
-_EnableIf<__libcpp_is_unsigned_integer<_Tp>::value, int>
+enable_if_t<__libcpp_is_unsigned_integer<_Tp>::value, int>
countr_zero(_Tp __t) noexcept
{
return __countr_zero(__t);
@@ -262,7 +262,7 @@ countr_zero(_Tp __t) noexcept
template<class _Tp>
_LIBCPP_INLINE_VISIBILITY constexpr
-_EnableIf<__libcpp_is_unsigned_integer<_Tp>::value, int>
+enable_if_t<__libcpp_is_unsigned_integer<_Tp>::value, int>
countr_one(_Tp __t) noexcept
{
return __countr_one(__t);
@@ -270,7 +270,7 @@ countr_one(_Tp __t) noexcept
template<class _Tp>
_LIBCPP_INLINE_VISIBILITY constexpr
-_EnableIf<__libcpp_is_unsigned_integer<_Tp>::value, int>
+enable_if_t<__libcpp_is_unsigned_integer<_Tp>::value, int>
popcount(_Tp __t) noexcept
{
return __popcount(__t);
@@ -278,7 +278,7 @@ popcount(_Tp __t) noexcept
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY constexpr
-_EnableIf<__libcpp_is_unsigned_integer<_Tp>::value, bool>
+enable_if_t<__libcpp_is_unsigned_integer<_Tp>::value, bool>
has_single_bit(_Tp __t) noexcept
{
return __has_single_bit(__t);
@@ -286,7 +286,7 @@ has_single_bit(_Tp __t) noexcept
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY constexpr
-_EnableIf<__libcpp_is_unsigned_integer<_Tp>::value, _Tp>
+enable_if_t<__libcpp_is_unsigned_integer<_Tp>::value, _Tp>
bit_floor(_Tp __t) noexcept
{
return __t == 0 ? 0 : _Tp{1} << __bit_log2(__t);
@@ -294,7 +294,7 @@ bit_floor(_Tp __t) noexcept
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY constexpr
-_EnableIf<__libcpp_is_unsigned_integer<_Tp>::value, _Tp>
+enable_if_t<__libcpp_is_unsigned_integer<_Tp>::value, _Tp>
bit_ceil(_Tp __t) noexcept
{
if (__t < 2) return 1;
@@ -313,7 +313,7 @@ bit_ceil(_Tp __t) noexcept
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY constexpr
-_EnableIf<__libcpp_is_unsigned_integer<_Tp>::value, _Tp>
+enable_if_t<__libcpp_is_unsigned_integer<_Tp>::value, _Tp>
bit_width(_Tp __t) noexcept
{
return __t == 0 ? 0 : __bit_log2(__t) + 1;
diff --git a/libcxx/include/cmath b/libcxx/include/cmath
index adf83c2b0a7b2..0a7ff083eb621 100644
--- a/libcxx/include/cmath
+++ b/libcxx/include/cmath
@@ -535,7 +535,7 @@ inline _LIBCPP_INLINE_VISIBILITY long double hypot( long double x, long double y
template <class _A1, class _A2, class _A3>
inline _LIBCPP_INLINE_VISIBILITY
-typename _EnableIf
+typename enable_if_t
<
is_arithmetic<_A1>::value &&
is_arithmetic<_A2>::value &&
diff --git a/libcxx/include/deque b/libcxx/include/deque
index f4caa9ef0af24..76e622bfce66a 100644
--- a/libcxx/include/deque
+++ b/libcxx/include/deque
@@ -1568,14 +1568,14 @@ public:
#if _LIBCPP_STD_VER >= 17
template<class _InputIterator,
class _Alloc = allocator<__iter_value_type<_InputIterator>>,
- class = _EnableIf<__is_allocator<_Alloc>::value>
+ class = enable_if_t<__is_allocator<_Alloc>::value>
>
deque(_InputIterator, _InputIterator)
-> deque<__iter_value_type<_InputIterator>, _Alloc>;
template<class _InputIterator,
class _Alloc,
- class = _EnableIf<__is_allocator<_Alloc>::value>
+ class = enable_if_t<__is_allocator<_Alloc>::value>
>
deque(_InputIterator, _InputIterator, _Alloc)
-> deque<__iter_value_type<_InputIterator>, _Alloc>;
diff --git a/libcxx/include/forward_list b/libcxx/include/forward_list
index 66aa75765b8fd..30b28d5571af1 100644
--- a/libcxx/include/forward_list
+++ b/libcxx/include/forward_list
@@ -873,14 +873,14 @@ private:
#if _LIBCPP_STD_VER >= 17
template<class _InputIterator,
class _Alloc = allocator<__iter_value_type<_InputIterator>>,
- class = _EnableIf<__is_allocator<_Alloc>::value>
+ class = enable_if_t<__is_allocator<_Alloc>::value>
>
forward_list(_InputIterator, _InputIterator)
-> forward_list<__iter_value_type<_InputIterator>, _Alloc>;
template<class _InputIterator,
class _Alloc,
- class = _EnableIf<__is_allocator<_Alloc>::value>
+ class = enable_if_t<__is_allocator<_Alloc>::value>
>
forward_list(_InputIterator, _InputIterator, _Alloc)
-> forward_list<__iter_value_type<_InputIterator>, _Alloc>;
diff --git a/libcxx/include/list b/libcxx/include/list
index 2ae6d588dd849..408c85b2ad552 100644
--- a/libcxx/include/list
+++ b/libcxx/include/list
@@ -1144,14 +1144,14 @@ private:
#if _LIBCPP_STD_VER >= 17
template<class _InputIterator,
class _Alloc = allocator<__iter_value_type<_InputIterator>>,
- class = _EnableIf<__is_allocator<_Alloc>::value>
+ class = enable_if_t<__is_allocator<_Alloc>::value>
>
list(_InputIterator, _InputIterator)
-> list<__iter_value_type<_InputIterator>, _Alloc>;
template<class _InputIterator,
class _Alloc,
- class = _EnableIf<__is_allocator<_Alloc>::value>
+ class = enable_if_t<__is_allocator<_Alloc>::value>
>
list(_InputIterator, _InputIterator, _Alloc)
-> list<__iter_value_type<_InputIterator>, _Alloc>;
diff --git a/libcxx/include/map b/libcxx/include/map
index 1ffb5a0fd121e..5ebf67b5f9fa4 100644
--- a/libcxx/include/map
+++ b/libcxx/include/map
@@ -1505,26 +1505,26 @@ private:
#if _LIBCPP_STD_VER >= 17
template<class _InputIterator, class _Compare = less<__iter_key_type<_InputIterator>>,
class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>,
- class = _EnableIf<!__is_allocator<_Compare>::value, void>,
- class = _EnableIf<__is_allocator<_Allocator>::value, void>>
+ class = enable_if_t<!__is_allocator<_Compare>::value, void>,
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>>
map(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator())
-> map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Compare, _Allocator>;
template<class _Key, class _Tp, class _Compare = less<remove_const_t<_Key>>,
class _Allocator = allocator<pair<const _Key, _Tp>>,
- class = _EnableIf<!__is_allocator<_Compare>::value, void>,
- class = _EnableIf<__is_allocator<_Allocator>::value, void>>
+ class = enable_if_t<!__is_allocator<_Compare>::value, void>,
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>>
map(initializer_list<pair<_Key, _Tp>>, _Compare = _Compare(), _Allocator = _Allocator())
-> map<remove_const_t<_Key>, _Tp, _Compare, _Allocator>;
template<class _InputIterator, class _Allocator,
- class = _EnableIf<__is_allocator<_Allocator>::value, void>>
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>>
map(_InputIterator, _InputIterator, _Allocator)
-> map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,
less<__iter_key_type<_InputIterator>>, _Allocator>;
template<class _Key, class _Tp, class _Allocator,
- class = _EnableIf<__is_allocator<_Allocator>::value, void>>
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>>
map(initializer_list<pair<_Key, _Tp>>, _Allocator)
-> map<remove_const_t<_Key>, _Tp, less<remove_const_t<_Key>>, _Allocator>;
#endif
@@ -2178,26 +2178,26 @@ private:
#if _LIBCPP_STD_VER >= 17
template<class _InputIterator, class _Compare = less<__iter_key_type<_InputIterator>>,
class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>,
- class = _EnableIf<!__is_allocator<_Compare>::value, void>,
- class = _EnableIf<__is_allocator<_Allocator>::value, void>>
+ class = enable_if_t<!__is_allocator<_Compare>::value, void>,
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>>
multimap(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator())
-> multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Compare, _Allocator>;
template<class _Key, class _Tp, class _Compare = less<remove_const_t<_Key>>,
class _Allocator = allocator<pair<const _Key, _Tp>>,
- class = _EnableIf<!__is_allocator<_Compare>::value, void>,
- class = _EnableIf<__is_allocator<_Allocator>::value, void>>
+ class = enable_if_t<!__is_allocator<_Compare>::value, void>,
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>>
multimap(initializer_list<pair<_Key, _Tp>>, _Compare = _Compare(), _Allocator = _Allocator())
-> multimap<remove_const_t<_Key>, _Tp, _Compare, _Allocator>;
template<class _InputIterator, class _Allocator,
- class = _EnableIf<__is_allocator<_Allocator>::value, void>>
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>>
multimap(_InputIterator, _InputIterator, _Allocator)
-> multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,
less<__iter_key_type<_InputIterator>>, _Allocator>;
template<class _Key, class _Tp, class _Allocator,
- class = _EnableIf<__is_allocator<_Allocator>::value, void>>
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>>
multimap(initializer_list<pair<_Key, _Tp>>, _Allocator)
-> multimap<remove_const_t<_Key>, _Tp, less<remove_const_t<_Key>>, _Allocator>;
#endif
diff --git a/libcxx/include/optional b/libcxx/include/optional
index d0b9f6d5171f8..ea43856dc7ffc 100644
--- a/libcxx/include/optional
+++ b/libcxx/include/optional
@@ -691,7 +691,7 @@ public:
_LIBCPP_INLINE_VISIBILITY constexpr optional(optional&&) = default;
_LIBCPP_INLINE_VISIBILITY constexpr optional(nullopt_t) noexcept {}
- template <class _InPlaceT, class... _Args, class = _EnableIf<
+ template <class _InPlaceT, class... _Args, class = enable_if_t<
_And<
_IsSame<_InPlaceT, in_place_t>,
is_constructible<value_type, _Args...>
@@ -702,21 +702,21 @@ public:
constexpr explicit optional(_InPlaceT, _Args&&... __args)
: __base(in_place, _VSTD::forward<_Args>(__args)...) {}
- template <class _Up, class... _Args, class = _EnableIf<
+ template <class _Up, class... _Args, class = enable_if_t<
is_constructible_v<value_type, initializer_list<_Up>&, _Args...>>
>
_LIBCPP_INLINE_VISIBILITY
constexpr explicit optional(in_place_t, initializer_list<_Up> __il, _Args&&... __args)
: __base(in_place, __il, _VSTD::forward<_Args>(__args)...) {}
- template <class _Up = value_type, _EnableIf<
+ template <class _Up = value_type, enable_if_t<
_CheckOptionalArgsCtor<_Up>::template __enable_implicit<_Up>()
, int> = 0>
_LIBCPP_INLINE_VISIBILITY
constexpr optional(_Up&& __v)
: __base(in_place, _VSTD::forward<_Up>(__v)) {}
- template <class _Up, _EnableIf<
+ template <class _Up, enable_if_t<
_CheckOptionalArgsCtor<_Up>::template __enable_explicit<_Up>()
, int> = 0>
_LIBCPP_INLINE_VISIBILITY
@@ -724,7 +724,7 @@ public:
: __base(in_place, _VSTD::forward<_Up>(__v)) {}
// LWG2756: conditionally explicit conversion from const optional<_Up>&
- template <class _Up, _EnableIf<
+ template <class _Up, enable_if_t<
_CheckOptionalLikeCtor<_Up, _Up const&>::template __enable_implicit<_Up>()
, int> = 0>
_LIBCPP_INLINE_VISIBILITY
@@ -732,7 +732,7 @@ public:
{
this->__construct_from(__v);
}
- template <class _Up, _EnableIf<
+ template <class _Up, enable_if_t<
_CheckOptionalLikeCtor<_Up, _Up const&>::template __enable_explicit<_Up>()
, int> = 0>
_LIBCPP_INLINE_VISIBILITY
@@ -742,7 +742,7 @@ public:
}
// LWG2756: conditionally explicit conversion from optional<_Up>&&
- template <class _Up, _EnableIf<
+ template <class _Up, enable_if_t<
_CheckOptionalLikeCtor<_Up, _Up &&>::template __enable_implicit<_Up>()
, int> = 0>
_LIBCPP_INLINE_VISIBILITY
@@ -750,7 +750,7 @@ public:
{
this->__construct_from(_VSTD::move(__v));
}
- template <class _Up, _EnableIf<
+ template <class _Up, enable_if_t<
_CheckOptionalLikeCtor<_Up, _Up &&>::template __enable_explicit<_Up>()
, int> = 0>
_LIBCPP_INLINE_VISIBILITY
@@ -771,7 +771,7 @@ public:
// LWG2756
template <class _Up = value_type,
- class = _EnableIf<
+ class = enable_if_t<
_And<
_IsNotSame<__uncvref_t<_Up>, optional>,
_Or<
@@ -794,7 +794,7 @@ public:
}
// LWG2756
- template <class _Up, _EnableIf<
+ template <class _Up, enable_if_t<
_CheckOptionalLikeAssign<_Up, _Up const&>::template __enable_assign<_Up>()
, int> = 0>
_LIBCPP_INLINE_VISIBILITY
@@ -806,7 +806,7 @@ public:
}
// LWG2756
- template <class _Up, _EnableIf<
+ template <class _Up, enable_if_t<
_CheckOptionalLikeCtor<_Up, _Up &&>::template __enable_assign<_Up>()
, int> = 0>
_LIBCPP_INLINE_VISIBILITY
@@ -818,7 +818,7 @@ public:
}
template <class... _Args,
- class = _EnableIf
+ class = enable_if_t
<
is_constructible_v<value_type, _Args...>
>
@@ -833,7 +833,7 @@ public:
}
template <class _Up, class... _Args,
- class = _EnableIf
+ class = enable_if_t
<
is_constructible_v<value_type, initializer_list<_Up>&, _Args...>
>
@@ -1004,7 +1004,7 @@ template<class T>
// Comparisons between optionals
template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY constexpr
-_EnableIf<
+enable_if_t<
is_convertible_v<decltype(declval<const _Tp&>() ==
declval<const _Up&>()), bool>,
bool
@@ -1020,7 +1020,7 @@ operator==(const optional<_Tp>& __x, const optional<_Up>& __y)
template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY constexpr
-_EnableIf<
+enable_if_t<
is_convertible_v<decltype(declval<const _Tp&>() !=
declval<const _Up&>()), bool>,
bool
@@ -1036,7 +1036,7 @@ operator!=(const optional<_Tp>& __x, const optional<_Up>& __y)
template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY constexpr
-_EnableIf<
+enable_if_t<
is_convertible_v<decltype(declval<const _Tp&>() <
declval<const _Up&>()), bool>,
bool
@@ -1052,7 +1052,7 @@ operator<(const optional<_Tp>& __x, const optional<_Up>& __y)
template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY constexpr
-_EnableIf<
+enable_if_t<
is_convertible_v<decltype(declval<const _Tp&>() >
declval<const _Up&>()), bool>,
bool
@@ -1068,7 +1068,7 @@ operator>(const optional<_Tp>& __x, const optional<_Up>& __y)
template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY constexpr
-_EnableIf<
+enable_if_t<
is_convertible_v<decltype(declval<const _Tp&>() <=
declval<const _Up&>()), bool>,
bool
@@ -1084,7 +1084,7 @@ operator<=(const optional<_Tp>& __x, const optional<_Up>& __y)
template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY constexpr
-_EnableIf<
+enable_if_t<
is_convertible_v<decltype(declval<const _Tp&>() >=
declval<const _Up&>()), bool>,
bool
@@ -1198,7 +1198,7 @@ operator>=(nullopt_t, const optional<_Tp>& __x) noexcept
// Comparisons with T
template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY constexpr
-_EnableIf<
+enable_if_t<
is_convertible_v<decltype(declval<const _Tp&>() ==
declval<const _Up&>()), bool>,
bool
@@ -1210,7 +1210,7 @@ operator==(const optional<_Tp>& __x, const _Up& __v)
template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY constexpr
-_EnableIf<
+enable_if_t<
is_convertible_v<decltype(declval<const _Tp&>() ==
declval<const _Up&>()), bool>,
bool
@@ -1222,7 +1222,7 @@ operator==(const _Tp& __v, const optional<_Up>& __x)
template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY constexpr
-_EnableIf<
+enable_if_t<
is_convertible_v<decltype(declval<const _Tp&>() !=
declval<const _Up&>()), bool>,
bool
@@ -1234,7 +1234,7 @@ operator!=(const optional<_Tp>& __x, const _Up& __v)
template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY constexpr
-_EnableIf<
+enable_if_t<
is_convertible_v<decltype(declval<const _Tp&>() !=
declval<const _Up&>()), bool>,
bool
@@ -1246,7 +1246,7 @@ operator!=(const _Tp& __v, const optional<_Up>& __x)
template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY constexpr
-_EnableIf<
+enable_if_t<
is_convertible_v<decltype(declval<const _Tp&>() <
declval<const _Up&>()), bool>,
bool
@@ -1258,7 +1258,7 @@ operator<(const optional<_Tp>& __x, const _Up& __v)
template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY constexpr
-_EnableIf<
+enable_if_t<
is_convertible_v<decltype(declval<const _Tp&>() <
declval<const _Up&>()), bool>,
bool
@@ -1270,7 +1270,7 @@ operator<(const _Tp& __v, const optional<_Up>& __x)
template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY constexpr
-_EnableIf<
+enable_if_t<
is_convertible_v<decltype(declval<const _Tp&>() <=
declval<const _Up&>()), bool>,
bool
@@ -1282,7 +1282,7 @@ operator<=(const optional<_Tp>& __x, const _Up& __v)
template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY constexpr
-_EnableIf<
+enable_if_t<
is_convertible_v<decltype(declval<const _Tp&>() <=
declval<const _Up&>()), bool>,
bool
@@ -1294,7 +1294,7 @@ operator<=(const _Tp& __v, const optional<_Up>& __x)
template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY constexpr
-_EnableIf<
+enable_if_t<
is_convertible_v<decltype(declval<const _Tp&>() >
declval<const _Up&>()), bool>,
bool
@@ -1306,7 +1306,7 @@ operator>(const optional<_Tp>& __x, const _Up& __v)
template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY constexpr
-_EnableIf<
+enable_if_t<
is_convertible_v<decltype(declval<const _Tp&>() >
declval<const _Up&>()), bool>,
bool
@@ -1318,7 +1318,7 @@ operator>(const _Tp& __v, const optional<_Up>& __x)
template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY constexpr
-_EnableIf<
+enable_if_t<
is_convertible_v<decltype(declval<const _Tp&>() >=
declval<const _Up&>()), bool>,
bool
@@ -1330,7 +1330,7 @@ operator>=(const optional<_Tp>& __x, const _Up& __v)
template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY constexpr
-_EnableIf<
+enable_if_t<
is_convertible_v<decltype(declval<const _Tp&>() >=
declval<const _Up&>()), bool>,
bool
@@ -1343,7 +1343,7 @@ operator>=(const _Tp& __v, const optional<_Up>& __x)
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
-_EnableIf<
+enable_if_t<
is_move_constructible_v<_Tp> && is_swappable_v<_Tp>,
void
>
diff --git a/libcxx/include/queue b/libcxx/include/queue
index 2a09bac7611d0..8662fa5393d86 100644
--- a/libcxx/include/queue
+++ b/libcxx/include/queue
@@ -360,15 +360,15 @@ public:
#if _LIBCPP_STD_VER >= 17
template<class _Container,
- class = _EnableIf<!__is_allocator<_Container>::value>
+ class = enable_if_t<!__is_allocator<_Container>::value>
>
queue(_Container)
-> queue<typename _Container::value_type, _Container>;
template<class _Container,
class _Alloc,
- class = _EnableIf<!__is_allocator<_Container>::value>,
- class = _EnableIf<uses_allocator<_Container, _Alloc>::value>
+ class = enable_if_t<!__is_allocator<_Container>::value>,
+ class = enable_if_t<uses_allocator<_Container, _Alloc>::value>
>
queue(_Container, _Alloc)
-> queue<typename _Container::value_type, _Container>;
@@ -587,8 +587,8 @@ public:
#if _LIBCPP_STD_VER >= 17
template <class _Compare,
class _Container,
- class = _EnableIf<!__is_allocator<_Compare>::value>,
- class = _EnableIf<!__is_allocator<_Container>::value>
+ class = enable_if_t<!__is_allocator<_Compare>::value>,
+ class = enable_if_t<!__is_allocator<_Container>::value>
>
priority_queue(_Compare, _Container)
-> priority_queue<typename _Container::value_type, _Container, _Compare>;
@@ -596,9 +596,9 @@ priority_queue(_Compare, _Container)
template<class _InputIterator,
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>
+ class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>,
+ class = enable_if_t<!__is_allocator<_Compare>::value>,
+ class = enable_if_t<!__is_allocator<_Container>::value>
>
priority_queue(_InputIterator, _InputIterator, _Compare = _Compare(), _Container = _Container())
-> priority_queue<__iter_value_type<_InputIterator>, _Container, _Compare>;
@@ -606,16 +606,16 @@ priority_queue(_InputIterator, _InputIterator, _Compare = _Compare(), _Container
template<class _Compare,
class _Container,
class _Alloc,
- class = _EnableIf<!__is_allocator<_Compare>::value>,
- class = _EnableIf<!__is_allocator<_Container>::value>,
- class = _EnableIf<uses_allocator<_Container, _Alloc>::value>
+ class = enable_if_t<!__is_allocator<_Compare>::value>,
+ class = enable_if_t<!__is_allocator<_Container>::value>,
+ class = enable_if_t<uses_allocator<_Container, _Alloc>::value>
>
priority_queue(_Compare, _Container, _Alloc)
-> priority_queue<typename _Container::value_type, _Container, _Compare>;
template<class _InputIterator, class _Allocator,
- class = _EnableIf<__is_cpp17_input_iterator<_InputIterator>::value>,
- class = _EnableIf<__is_allocator<_Allocator>::value>
+ class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>
>
priority_queue(_InputIterator, _InputIterator, _Allocator)
-> priority_queue<__iter_value_type<_InputIterator>,
@@ -623,19 +623,19 @@ priority_queue(_InputIterator, _InputIterator, _Allocator)
less<__iter_value_type<_InputIterator>>>;
template<class _InputIterator, class _Compare, class _Allocator,
- class = _EnableIf<__is_cpp17_input_iterator<_InputIterator>::value>,
- class = _EnableIf<!__is_allocator<_Compare>::value>,
- class = _EnableIf<__is_allocator<_Allocator>::value>
+ class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>,
+ class = enable_if_t<!__is_allocator<_Compare>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>
>
priority_queue(_InputIterator, _InputIterator, _Compare, _Allocator)
-> priority_queue<__iter_value_type<_InputIterator>,
vector<__iter_value_type<_InputIterator>, _Allocator>, _Compare>;
template<class _InputIterator, class _Compare, class _Container, class _Alloc,
- class = _EnableIf<__is_cpp17_input_iterator<_InputIterator>::value>,
- class = _EnableIf<!__is_allocator<_Compare>::value>,
- class = _EnableIf<!__is_allocator<_Container>::value>,
- class = _EnableIf<uses_allocator<_Container, _Alloc>::value>
+ class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>,
+ class = enable_if_t<!__is_allocator<_Compare>::value>,
+ class = enable_if_t<!__is_allocator<_Container>::value>,
+ class = enable_if_t<uses_allocator<_Container, _Alloc>::value>
>
priority_queue(_InputIterator, _InputIterator, _Compare, _Container, _Alloc)
-> priority_queue<typename _Container::value_type, _Container, _Compare>;
diff --git a/libcxx/include/set b/libcxx/include/set
index 04f8fc2521d9f..a5e80206519b9 100644
--- a/libcxx/include/set
+++ b/libcxx/include/set
@@ -872,26 +872,26 @@ public:
template<class _InputIterator,
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>>
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>,
+ class = enable_if_t<!__is_allocator<_Compare>::value, void>>
set(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator())
-> set<__iter_value_type<_InputIterator>, _Compare, _Allocator>;
template<class _Key, class _Compare = less<_Key>,
class _Allocator = allocator<_Key>,
- class = _EnableIf<__is_allocator<_Allocator>::value, void>,
- class = _EnableIf<!__is_allocator<_Compare>::value, void>>
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>,
+ class = enable_if_t<!__is_allocator<_Compare>::value, void>>
set(initializer_list<_Key>, _Compare = _Compare(), _Allocator = _Allocator())
-> set<_Key, _Compare, _Allocator>;
template<class _InputIterator, class _Allocator,
- class = _EnableIf<__is_allocator<_Allocator>::value, void>>
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>>
set(_InputIterator, _InputIterator, _Allocator)
-> set<__iter_value_type<_InputIterator>,
less<__iter_value_type<_InputIterator>>, _Allocator>;
template<class _Key, class _Allocator,
- class = _EnableIf<__is_allocator<_Allocator>::value, void>>
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>>
set(initializer_list<_Key>, _Allocator)
-> set<_Key, less<_Key>, _Allocator>;
#endif
@@ -1403,26 +1403,26 @@ public:
template<class _InputIterator,
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>>
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>,
+ class = enable_if_t<!__is_allocator<_Compare>::value, void>>
multiset(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator())
-> multiset<__iter_value_type<_InputIterator>, _Compare, _Allocator>;
template<class _Key, class _Compare = less<_Key>,
class _Allocator = allocator<_Key>,
- class = _EnableIf<__is_allocator<_Allocator>::value, void>,
- class = _EnableIf<!__is_allocator<_Compare>::value, void>>
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>,
+ class = enable_if_t<!__is_allocator<_Compare>::value, void>>
multiset(initializer_list<_Key>, _Compare = _Compare(), _Allocator = _Allocator())
-> multiset<_Key, _Compare, _Allocator>;
template<class _InputIterator, class _Allocator,
- class = _EnableIf<__is_allocator<_Allocator>::value, void>>
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>>
multiset(_InputIterator, _InputIterator, _Allocator)
-> multiset<__iter_value_type<_InputIterator>,
less<__iter_value_type<_InputIterator>>, _Allocator>;
template<class _Key, class _Allocator,
- class = _EnableIf<__is_allocator<_Allocator>::value, void>>
+ class = enable_if_t<__is_allocator<_Allocator>::value, void>>
multiset(initializer_list<_Key>, _Allocator)
-> multiset<_Key, less<_Key>, _Allocator>;
#endif
diff --git a/libcxx/include/stack b/libcxx/include/stack
index 5ee4d5176ec4e..79cc15d964544 100644
--- a/libcxx/include/stack
+++ b/libcxx/include/stack
@@ -233,15 +233,15 @@ public:
#if _LIBCPP_STD_VER >= 17
template<class _Container,
- class = _EnableIf<!__is_allocator<_Container>::value>
+ class = enable_if_t<!__is_allocator<_Container>::value>
>
stack(_Container)
-> stack<typename _Container::value_type, _Container>;
template<class _Container,
class _Alloc,
- class = _EnableIf<!__is_allocator<_Container>::value>,
- class = _EnableIf<uses_allocator<_Container, _Alloc>::value>
+ class = enable_if_t<!__is_allocator<_Container>::value>,
+ class = enable_if_t<uses_allocator<_Container, _Alloc>::value>
>
stack(_Container, _Alloc)
-> stack<typename _Container::value_type, _Container>;
diff --git a/libcxx/include/string b/libcxx/include/string
index 15777653ed485..e33407c39dc98 100644
--- a/libcxx/include/string
+++ b/libcxx/include/string
@@ -1755,8 +1755,8 @@ _LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE, wchar_t)
template<class _InputIterator,
class _CharT = __iter_value_type<_InputIterator>,
class _Allocator = allocator<_CharT>,
- class = _EnableIf<__is_cpp17_input_iterator<_InputIterator>::value>,
- class = _EnableIf<__is_allocator<_Allocator>::value>
+ class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>
>
basic_string(_InputIterator, _InputIterator, _Allocator = _Allocator())
-> basic_string<_CharT, char_traits<_CharT>, _Allocator>;
@@ -1764,7 +1764,7 @@ basic_string(_InputIterator, _InputIterator, _Allocator = _Allocator())
template<class _CharT,
class _Traits,
class _Allocator = allocator<_CharT>,
- class = _EnableIf<__is_allocator<_Allocator>::value>
+ class = enable_if_t<__is_allocator<_Allocator>::value>
>
explicit basic_string(basic_string_view<_CharT, _Traits>, const _Allocator& = _Allocator())
-> basic_string<_CharT, _Traits, _Allocator>;
@@ -1772,7 +1772,7 @@ explicit basic_string(basic_string_view<_CharT, _Traits>, const _Allocator& = _A
template<class _CharT,
class _Traits,
class _Allocator = allocator<_CharT>,
- class = _EnableIf<__is_allocator<_Allocator>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>,
class _Sz = typename allocator_traits<_Allocator>::size_type
>
basic_string(basic_string_view<_CharT, _Traits>, _Sz, _Sz, const _Allocator& = _Allocator())
diff --git a/libcxx/include/type_traits b/libcxx/include/type_traits
index 3f44ee3b2cfe9..b0f18c891e5be 100644
--- a/libcxx/include/type_traits
+++ b/libcxx/include/type_traits
@@ -455,6 +455,15 @@ using bool_constant = integral_constant<bool, __b>;
#define _LIBCPP_BOOL_CONSTANT(__b) integral_constant<bool,(__b)>
#endif
+template <bool, class _Tp = void> struct _LIBCPP_TEMPLATE_VIS enable_if {};
+template <class _Tp> struct _LIBCPP_TEMPLATE_VIS enable_if<true, _Tp> {typedef _Tp type;};
+
+template <bool _Bp, class _Tp = void> using _EnableIf _LIBCPP_NODEBUG = typename enable_if<_Bp, _Tp>::type;
+
+#if _LIBCPP_STD_VER > 11
+template <bool _Bp, class _Tp = void> using enable_if_t = typename enable_if<_Bp, _Tp>::type;
+#endif
+
typedef _LIBCPP_BOOL_CONSTANT(true) true_type;
typedef _LIBCPP_BOOL_CONSTANT(false) false_type;
@@ -472,8 +481,6 @@ struct _MetaBase<true> {
using _FirstImpl _LIBCPP_NODEBUG = _First;
template <class, class _Second, class...>
using _SecondImpl _LIBCPP_NODEBUG = _Second;
- template <class _Tp = void>
- using _EnableIfImpl _LIBCPP_NODEBUG = _Tp;
template <class _Result, class _First, class ..._Rest>
using _OrImpl _LIBCPP_NODEBUG = typename _MetaBase<_First::value != true && sizeof...(_Rest) != 0>::template _OrImpl<_First, _Rest...>;
};
@@ -487,8 +494,6 @@ struct _MetaBase<false> {
template <class _Result, class ...>
using _OrImpl _LIBCPP_NODEBUG = _Result;
};
-template <bool _Cond, class _Ret = void>
-using _EnableIf _LIBCPP_NODEBUG = typename _MetaBase<_Cond>::template _EnableIfImpl<_Ret>;
template <bool _Cond, class _IfRes, class _ElseRes>
using _If _LIBCPP_NODEBUG = typename _MetaBase<_Cond>::template _SelectImpl<_IfRes, _ElseRes>;
template <class ..._Rest>
@@ -543,13 +548,6 @@ template <class _If, class _Then>
template <bool _Bp, class _If, class _Then> using conditional_t = typename conditional<_Bp, _If, _Then>::type;
#endif
-template <bool, class _Tp = void> struct _LIBCPP_TEMPLATE_VIS enable_if {};
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS enable_if<true, _Tp> {typedef _Tp type;};
-
-#if _LIBCPP_STD_VER > 11
-template <bool _Bp, class _Tp = void> using enable_if_t = typename enable_if<_Bp, _Tp>::type;
-#endif
-
// is_same
#if __has_keyword(__is_same)
diff --git a/libcxx/include/unordered_map b/libcxx/include/unordered_map
index 969e67395dce0..c53fb18910f49 100644
--- a/libcxx/include/unordered_map
+++ b/libcxx/include/unordered_map
@@ -473,7 +473,7 @@ public:
size_t operator()(const _Key& __x) const
{return static_cast<const _Hash&>(*this)(__x);}
#if _LIBCPP_STD_VER > 17
- template <typename _K2, typename = _EnableIf<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>>
+ template <typename _K2, typename = enable_if_t<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>>
_LIBCPP_INLINE_VISIBILITY
size_t operator()(const _K2& __x) const
{return static_cast<const _Hash&>(*this)(__x);}
@@ -508,7 +508,7 @@ public:
size_t operator()(const _Key& __x) const
{return __hash_(__x);}
#if _LIBCPP_STD_VER > 17
- template <typename _K2, typename = _EnableIf<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>>
+ template <typename _K2, typename = enable_if_t<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>>
_LIBCPP_INLINE_VISIBILITY
size_t operator()(const _K2& __x) const
{return __hash_(__x);}
@@ -557,19 +557,19 @@ public:
bool operator()(const _Key& __x, const _Cp& __y) const
{return static_cast<const _Pred&>(*this)(__x, __y.__get_value().first);}
#if _LIBCPP_STD_VER > 17
- template <typename _K2, typename = _EnableIf<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>>
+ template <typename _K2, typename = enable_if_t<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>>
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Cp& __x, const _K2& __y) const
{return static_cast<const _Pred&>(*this)(__x.__get_value().first, __y);}
- template <typename _K2, typename = _EnableIf<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>>
+ template <typename _K2, typename = enable_if_t<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>>
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _K2& __x, const _Cp& __y) const
{return static_cast<const _Pred&>(*this)(__x, __y.__get_value().first);}
- template <typename _K2, typename = _EnableIf<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>>
+ template <typename _K2, typename = enable_if_t<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>>
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Key& __x, const _K2& __y) const
{return static_cast<const _Pred&>(*this)(__x, __y);}
- template <typename _K2, typename = _EnableIf<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>>
+ template <typename _K2, typename = enable_if_t<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>>
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _K2& __x, const _Key& __y) const
{return static_cast<const _Pred&>(*this)(__x, __y);}
@@ -607,19 +607,19 @@ public:
bool operator()(const _Key& __x, const _Cp& __y) const
{return __pred_(__x, __y.__get_value().first);}
#if _LIBCPP_STD_VER > 17
- template <typename _K2, typename = _EnableIf<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>>
+ template <typename _K2, typename = enable_if_t<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>>
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Cp& __x, const _K2& __y) const
{return __pred_(__x.__get_value().first, __y);}
- template <typename _K2, typename = _EnableIf<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>>
+ template <typename _K2, typename = enable_if_t<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>>
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _K2& __x, const _Cp& __y) const
{return __pred_(__x, __y.__get_value().first);}
- template <typename _K2, typename = _EnableIf<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>>
+ template <typename _K2, typename = enable_if_t<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>>
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Key& __x, const _K2& __y) const
{return __pred_(__x, __y);}
- template <typename _K2, typename = _EnableIf<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>>
+ template <typename _K2, typename = enable_if_t<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>>
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _K2& __x, const _Key& __y) const
{return __pred_(__x, __y);}
@@ -1359,11 +1359,11 @@ public:
#if _LIBCPP_STD_VER > 17
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
- _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, iterator>
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, iterator>
find(const _K2& __k) {return __table_.find(__k);}
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
- _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, const_iterator>
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, const_iterator>
find(const _K2& __k) const {return __table_.find(__k);}
#endif // _LIBCPP_STD_VER > 17
@@ -1372,7 +1372,7 @@ public:
#if _LIBCPP_STD_VER > 17
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
- _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, size_type>
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, size_type>
count(const _K2& __k) const {return __table_.__count_unique(__k);}
#endif // _LIBCPP_STD_VER > 17
#if _LIBCPP_STD_VER > 17
@@ -1381,7 +1381,7 @@ public:
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
- _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, bool>
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, bool>
contains(const _K2& __k) const {return find(__k) != end();}
#endif // _LIBCPP_STD_VER > 17
_LIBCPP_INLINE_VISIBILITY
@@ -1393,11 +1393,11 @@ public:
#if _LIBCPP_STD_VER > 17
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
- _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, pair<iterator, iterator>>
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, pair<iterator, iterator>>
equal_range(const _K2& __k) {return __table_.__equal_range_unique(__k);}
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
- _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, pair<const_iterator, const_iterator>>
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, pair<const_iterator, const_iterator>>
equal_range(const _K2& __k) const {return __table_.__equal_range_unique(__k);}
#endif // _LIBCPP_STD_VER > 17
@@ -1469,10 +1469,10 @@ template<class _InputIterator,
class _Hash = hash<__iter_key_type<_InputIterator>>,
class _Pred = equal_to<__iter_key_type<_InputIterator>>,
class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>,
- class = _EnableIf<!__is_allocator<_Hash>::value>,
- class = _EnableIf<!is_integral<_Hash>::value>,
- class = _EnableIf<!__is_allocator<_Pred>::value>,
- class = _EnableIf<__is_allocator<_Allocator>::value>>
+ class = enable_if_t<!__is_allocator<_Hash>::value>,
+ class = enable_if_t<!is_integral<_Hash>::value>,
+ class = enable_if_t<!__is_allocator<_Pred>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_map(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type = 0,
_Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
-> unordered_map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Hash, _Pred, _Allocator>;
@@ -1480,52 +1480,52 @@ unordered_map(_InputIterator, _InputIterator, typename allocator_traits<_Allocat
template<class _Key, class _Tp, class _Hash = hash<remove_const_t<_Key>>,
class _Pred = equal_to<remove_const_t<_Key>>,
class _Allocator = allocator<pair<const _Key, _Tp>>,
- class = _EnableIf<!__is_allocator<_Hash>::value>,
- class = _EnableIf<!is_integral<_Hash>::value>,
- class = _EnableIf<!__is_allocator<_Pred>::value>,
- class = _EnableIf<__is_allocator<_Allocator>::value>>
+ class = enable_if_t<!__is_allocator<_Hash>::value>,
+ class = enable_if_t<!is_integral<_Hash>::value>,
+ class = enable_if_t<!__is_allocator<_Pred>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_map(initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type = 0,
_Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
-> unordered_map<remove_const_t<_Key>, _Tp, _Hash, _Pred, _Allocator>;
template<class _InputIterator, class _Allocator,
- class = _EnableIf<__is_allocator<_Allocator>::value>>
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_map(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Allocator)
-> unordered_map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,
hash<__iter_key_type<_InputIterator>>, equal_to<__iter_key_type<_InputIterator>>, _Allocator>;
template<class _InputIterator, class _Allocator,
- class = _EnableIf<__is_allocator<_Allocator>::value>>
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_map(_InputIterator, _InputIterator, _Allocator)
-> unordered_map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,
hash<__iter_key_type<_InputIterator>>, equal_to<__iter_key_type<_InputIterator>>, _Allocator>;
template<class _InputIterator, class _Hash, class _Allocator,
- class = _EnableIf<!__is_allocator<_Hash>::value>,
- class = _EnableIf<!is_integral<_Hash>::value>,
- class = _EnableIf<__is_allocator<_Allocator>::value>>
+ class = enable_if_t<!__is_allocator<_Hash>::value>,
+ class = enable_if_t<!is_integral<_Hash>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_map(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
-> unordered_map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,
_Hash, equal_to<__iter_key_type<_InputIterator>>, _Allocator>;
template<class _Key, class _Tp, class _Allocator,
- class = _EnableIf<__is_allocator<_Allocator>::value>>
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_map(initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type, _Allocator)
-> unordered_map<remove_const_t<_Key>, _Tp,
hash<remove_const_t<_Key>>,
equal_to<remove_const_t<_Key>>, _Allocator>;
template<class _Key, class _Tp, class _Allocator,
- class = _EnableIf<__is_allocator<_Allocator>::value>>
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_map(initializer_list<pair<_Key, _Tp>>, _Allocator)
-> unordered_map<remove_const_t<_Key>, _Tp,
hash<remove_const_t<_Key>>,
equal_to<remove_const_t<_Key>>, _Allocator>;
template<class _Key, class _Tp, class _Hash, class _Allocator,
- class = _EnableIf<!__is_allocator<_Hash>::value>,
- class = _EnableIf<!is_integral<_Hash>::value>,
- class = _EnableIf<__is_allocator<_Allocator>::value>>
+ class = enable_if_t<!__is_allocator<_Hash>::value>,
+ class = enable_if_t<!is_integral<_Hash>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_map(initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
-> unordered_map<remove_const_t<_Key>, _Tp, _Hash,
equal_to<remove_const_t<_Key>>, _Allocator>;
@@ -2170,11 +2170,11 @@ public:
#if _LIBCPP_STD_VER > 17
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
- _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, iterator>
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, iterator>
find(const _K2& __k) {return __table_.find(__k);}
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
- _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, const_iterator>
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, const_iterator>
find(const _K2& __k) const {return __table_.find(__k);}
#endif // _LIBCPP_STD_VER > 17
_LIBCPP_INLINE_VISIBILITY
@@ -2182,7 +2182,7 @@ public:
#if _LIBCPP_STD_VER > 17
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
- _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, size_type>
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, size_type>
count(const _K2& __k) const {return __table_.__count_multi(__k);}
#endif // _LIBCPP_STD_VER > 17
#if _LIBCPP_STD_VER > 17
@@ -2191,7 +2191,7 @@ public:
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
- _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, bool>
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, bool>
contains(const _K2& __k) const {return find(__k) != end();}
#endif // _LIBCPP_STD_VER > 17
_LIBCPP_INLINE_VISIBILITY
@@ -2203,11 +2203,11 @@ public:
#if _LIBCPP_STD_VER > 17
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
- _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, pair<iterator, iterator>>
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, pair<iterator, iterator>>
equal_range(const _K2& __k) {return __table_.__equal_range_multi(__k);}
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
- _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, pair<const_iterator, const_iterator>>
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, pair<const_iterator, const_iterator>>
equal_range(const _K2& __k) const {return __table_.__equal_range_multi(__k);}
#endif // _LIBCPP_STD_VER > 17
@@ -2268,10 +2268,10 @@ template<class _InputIterator,
class _Hash = hash<__iter_key_type<_InputIterator>>,
class _Pred = equal_to<__iter_key_type<_InputIterator>>,
class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>,
- class = _EnableIf<!__is_allocator<_Hash>::value>,
- class = _EnableIf<!is_integral<_Hash>::value>,
- class = _EnableIf<!__is_allocator<_Pred>::value>,
- class = _EnableIf<__is_allocator<_Allocator>::value>>
+ class = enable_if_t<!__is_allocator<_Hash>::value>,
+ class = enable_if_t<!is_integral<_Hash>::value>,
+ class = enable_if_t<!__is_allocator<_Pred>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_multimap(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type = 0,
_Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
-> unordered_multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Hash, _Pred, _Allocator>;
@@ -2279,52 +2279,52 @@ unordered_multimap(_InputIterator, _InputIterator, typename allocator_traits<_Al
template<class _Key, class _Tp, class _Hash = hash<remove_const_t<_Key>>,
class _Pred = equal_to<remove_const_t<_Key>>,
class _Allocator = allocator<pair<const _Key, _Tp>>,
- class = _EnableIf<!__is_allocator<_Hash>::value>,
- class = _EnableIf<!is_integral<_Hash>::value>,
- class = _EnableIf<!__is_allocator<_Pred>::value>,
- class = _EnableIf<__is_allocator<_Allocator>::value>>
+ class = enable_if_t<!__is_allocator<_Hash>::value>,
+ class = enable_if_t<!is_integral<_Hash>::value>,
+ class = enable_if_t<!__is_allocator<_Pred>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_multimap(initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type = 0,
_Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
-> unordered_multimap<remove_const_t<_Key>, _Tp, _Hash, _Pred, _Allocator>;
template<class _InputIterator, class _Allocator,
- class = _EnableIf<__is_allocator<_Allocator>::value>>
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_multimap(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Allocator)
-> unordered_multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,
hash<__iter_key_type<_InputIterator>>, equal_to<__iter_key_type<_InputIterator>>, _Allocator>;
template<class _InputIterator, class _Allocator,
- class = _EnableIf<__is_allocator<_Allocator>::value>>
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_multimap(_InputIterator, _InputIterator, _Allocator)
-> unordered_multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,
hash<__iter_key_type<_InputIterator>>, equal_to<__iter_key_type<_InputIterator>>, _Allocator>;
template<class _InputIterator, class _Hash, class _Allocator,
- class = _EnableIf<!__is_allocator<_Hash>::value>,
- class = _EnableIf<!is_integral<_Hash>::value>,
- class = _EnableIf<__is_allocator<_Allocator>::value>>
+ class = enable_if_t<!__is_allocator<_Hash>::value>,
+ class = enable_if_t<!is_integral<_Hash>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_multimap(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
-> unordered_multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>,
_Hash, equal_to<__iter_key_type<_InputIterator>>, _Allocator>;
template<class _Key, class _Tp, class _Allocator,
- class = _EnableIf<__is_allocator<_Allocator>::value>>
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_multimap(initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type, _Allocator)
-> unordered_multimap<remove_const_t<_Key>, _Tp,
hash<remove_const_t<_Key>>,
equal_to<remove_const_t<_Key>>, _Allocator>;
template<class _Key, class _Tp, class _Allocator,
- class = _EnableIf<__is_allocator<_Allocator>::value>>
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_multimap(initializer_list<pair<_Key, _Tp>>, _Allocator)
-> unordered_multimap<remove_const_t<_Key>, _Tp,
hash<remove_const_t<_Key>>,
equal_to<remove_const_t<_Key>>, _Allocator>;
template<class _Key, class _Tp, class _Hash, class _Allocator,
- class = _EnableIf<!__is_allocator<_Hash>::value>,
- class = _EnableIf<!is_integral<_Hash>::value>,
- class = _EnableIf<__is_allocator<_Allocator>::value>>
+ class = enable_if_t<!__is_allocator<_Hash>::value>,
+ class = enable_if_t<!is_integral<_Hash>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_multimap(initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
-> unordered_multimap<remove_const_t<_Key>, _Tp, _Hash,
equal_to<remove_const_t<_Key>>, _Allocator>;
diff --git a/libcxx/include/unordered_set b/libcxx/include/unordered_set
index de87dcd2b74ed..0bac48a2422e0 100644
--- a/libcxx/include/unordered_set
+++ b/libcxx/include/unordered_set
@@ -709,11 +709,11 @@ public:
#if _LIBCPP_STD_VER > 17
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
- _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, iterator>
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, iterator>
find(const _K2& __k) {return __table_.find(__k);}
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
- _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, const_iterator>
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, const_iterator>
find(const _K2& __k) const {return __table_.find(__k);}
#endif // _LIBCPP_STD_VER > 17
_LIBCPP_INLINE_VISIBILITY
@@ -721,7 +721,7 @@ public:
#if _LIBCPP_STD_VER > 17
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
- _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, size_type>
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, size_type>
count(const _K2& __k) const {return __table_.__count_unique(__k);}
#endif // _LIBCPP_STD_VER > 17
#if _LIBCPP_STD_VER > 17
@@ -730,7 +730,7 @@ public:
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
- _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, bool>
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, bool>
contains(const _K2& __k) const {return find(__k) != end();}
#endif // _LIBCPP_STD_VER > 17
_LIBCPP_INLINE_VISIBILITY
@@ -742,11 +742,11 @@ public:
#if _LIBCPP_STD_VER > 17
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
- _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, pair<iterator, iterator>>
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, pair<iterator, iterator>>
equal_range(const _K2& __k) {return __table_.__equal_range_unique(__k);}
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
- _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, pair<const_iterator, const_iterator>>
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, pair<const_iterator, const_iterator>>
equal_range(const _K2& __k) const {return __table_.__equal_range_unique(__k);}
#endif // _LIBCPP_STD_VER > 17
@@ -804,10 +804,10 @@ template<class _InputIterator,
class _Hash = hash<__iter_value_type<_InputIterator>>,
class _Pred = equal_to<__iter_value_type<_InputIterator>>,
class _Allocator = allocator<__iter_value_type<_InputIterator>>,
- class = _EnableIf<!__is_allocator<_Hash>::value>,
- class = _EnableIf<!is_integral<_Hash>::value>,
- class = _EnableIf<!__is_allocator<_Pred>::value>,
- class = _EnableIf<__is_allocator<_Allocator>::value>>
+ class = enable_if_t<!__is_allocator<_Hash>::value>,
+ class = enable_if_t<!is_integral<_Hash>::value>,
+ class = enable_if_t<!__is_allocator<_Pred>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_set(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type = 0,
_Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
-> unordered_set<__iter_value_type<_InputIterator>, _Hash, _Pred, _Allocator>;
@@ -815,16 +815,16 @@ unordered_set(_InputIterator, _InputIterator, typename allocator_traits<_Allocat
template<class _Tp, class _Hash = hash<_Tp>,
class _Pred = equal_to<_Tp>,
class _Allocator = allocator<_Tp>,
- class = _EnableIf<!__is_allocator<_Hash>::value>,
- class = _EnableIf<!is_integral<_Hash>::value>,
- class = _EnableIf<!__is_allocator<_Pred>::value>,
- class = _EnableIf<__is_allocator<_Allocator>::value>>
+ class = enable_if_t<!__is_allocator<_Hash>::value>,
+ class = enable_if_t<!is_integral<_Hash>::value>,
+ class = enable_if_t<!__is_allocator<_Pred>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_set(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type = 0,
_Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
-> unordered_set<_Tp, _Hash, _Pred, _Allocator>;
template<class _InputIterator, class _Allocator,
- class = _EnableIf<__is_allocator<_Allocator>::value>>
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_set(_InputIterator, _InputIterator,
typename allocator_traits<_Allocator>::size_type, _Allocator)
-> unordered_set<__iter_value_type<_InputIterator>,
@@ -833,9 +833,9 @@ unordered_set(_InputIterator, _InputIterator,
_Allocator>;
template<class _InputIterator, class _Hash, class _Allocator,
- class = _EnableIf<!__is_allocator<_Hash>::value>,
- class = _EnableIf<!is_integral<_Hash>::value>,
- class = _EnableIf<__is_allocator<_Allocator>::value>>
+ class = enable_if_t<!__is_allocator<_Hash>::value>,
+ class = enable_if_t<!is_integral<_Hash>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_set(_InputIterator, _InputIterator,
typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
-> unordered_set<__iter_value_type<_InputIterator>, _Hash,
@@ -843,14 +843,14 @@ unordered_set(_InputIterator, _InputIterator,
_Allocator>;
template<class _Tp, class _Allocator,
- class = _EnableIf<__is_allocator<_Allocator>::value>>
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_set(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Allocator)
-> unordered_set<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>;
template<class _Tp, class _Hash, class _Allocator,
- class = _EnableIf<!__is_allocator<_Hash>::value>,
- class = _EnableIf<!is_integral<_Hash>::value>,
- class = _EnableIf<__is_allocator<_Allocator>::value>>
+ class = enable_if_t<!__is_allocator<_Hash>::value>,
+ class = enable_if_t<!is_integral<_Hash>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_set(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
-> unordered_set<_Tp, _Hash, equal_to<_Tp>, _Allocator>;
#endif
@@ -1375,11 +1375,11 @@ public:
#if _LIBCPP_STD_VER > 17
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
- _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, iterator>
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, iterator>
find(const _K2& __k) {return __table_.find(__k);}
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
- _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, const_iterator>
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, const_iterator>
find(const _K2& __k) const {return __table_.find(__k);}
#endif // _LIBCPP_STD_VER > 17
_LIBCPP_INLINE_VISIBILITY
@@ -1387,7 +1387,7 @@ public:
#if _LIBCPP_STD_VER > 17
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
- _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, size_type>
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, size_type>
count(const _K2& __k) const {return __table_.__count_multi(__k);}
#endif // _LIBCPP_STD_VER > 17
#if _LIBCPP_STD_VER > 17
@@ -1396,7 +1396,7 @@ public:
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
- _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, bool>
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, bool>
contains(const _K2& __k) const {return find(__k) != end();}
#endif // _LIBCPP_STD_VER > 17
_LIBCPP_INLINE_VISIBILITY
@@ -1408,11 +1408,11 @@ public:
#if _LIBCPP_STD_VER > 17
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
- _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, pair<iterator, iterator>>
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, pair<iterator, iterator>>
equal_range(const _K2& __k) {return __table_.__equal_range_multi(__k);}
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
- _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, pair<const_iterator, const_iterator>>
+ enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, pair<const_iterator, const_iterator>>
equal_range(const _K2& __k) const {return __table_.__equal_range_multi(__k);}
#endif // _LIBCPP_STD_VER > 17
@@ -1470,26 +1470,26 @@ template<class _InputIterator,
class _Hash = hash<__iter_value_type<_InputIterator>>,
class _Pred = equal_to<__iter_value_type<_InputIterator>>,
class _Allocator = allocator<__iter_value_type<_InputIterator>>,
- class = _EnableIf<!__is_allocator<_Hash>::value>,
- class = _EnableIf<!is_integral<_Hash>::value>,
- class = _EnableIf<!__is_allocator<_Pred>::value>,
- class = _EnableIf<__is_allocator<_Allocator>::value>>
+ class = enable_if_t<!__is_allocator<_Hash>::value>,
+ class = enable_if_t<!is_integral<_Hash>::value>,
+ class = enable_if_t<!__is_allocator<_Pred>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_multiset(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type = 0,
_Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
-> unordered_multiset<__iter_value_type<_InputIterator>, _Hash, _Pred, _Allocator>;
template<class _Tp, class _Hash = hash<_Tp>,
class _Pred = equal_to<_Tp>, class _Allocator = allocator<_Tp>,
- class = _EnableIf<!__is_allocator<_Hash>::value>,
- class = _EnableIf<!is_integral<_Hash>::value>,
- class = _EnableIf<!__is_allocator<_Pred>::value>,
- class = _EnableIf<__is_allocator<_Allocator>::value>>
+ class = enable_if_t<!__is_allocator<_Hash>::value>,
+ class = enable_if_t<!is_integral<_Hash>::value>,
+ class = enable_if_t<!__is_allocator<_Pred>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_multiset(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type = 0,
_Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
-> unordered_multiset<_Tp, _Hash, _Pred, _Allocator>;
template<class _InputIterator, class _Allocator,
- class = _EnableIf<__is_allocator<_Allocator>::value>>
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_multiset(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Allocator)
-> unordered_multiset<__iter_value_type<_InputIterator>,
hash<__iter_value_type<_InputIterator>>,
@@ -1497,9 +1497,9 @@ unordered_multiset(_InputIterator, _InputIterator, typename allocator_traits<_Al
_Allocator>;
template<class _InputIterator, class _Hash, class _Allocator,
- class = _EnableIf<!__is_allocator<_Hash>::value>,
- class = _EnableIf<!is_integral<_Hash>::value>,
- class = _EnableIf<__is_allocator<_Allocator>::value>>
+ class = enable_if_t<!__is_allocator<_Hash>::value>,
+ class = enable_if_t<!is_integral<_Hash>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_multiset(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type,
_Hash, _Allocator)
-> unordered_multiset<__iter_value_type<_InputIterator>, _Hash,
@@ -1507,14 +1507,14 @@ unordered_multiset(_InputIterator, _InputIterator, typename allocator_traits<_Al
_Allocator>;
template<class _Tp, class _Allocator,
- class = _EnableIf<__is_allocator<_Allocator>::value>>
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_multiset(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Allocator)
-> unordered_multiset<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>;
template<class _Tp, class _Hash, class _Allocator,
- class = _EnableIf<!__is_allocator<_Hash>::value>,
- class = _EnableIf<!is_integral<_Hash>::value>,
- class = _EnableIf<__is_allocator<_Allocator>::value>>
+ class = enable_if_t<!__is_allocator<_Hash>::value>,
+ class = enable_if_t<!is_integral<_Hash>::value>,
+ class = enable_if_t<__is_allocator<_Allocator>::value>>
unordered_multiset(initializer_list<_Tp>, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator)
-> unordered_multiset<_Tp, _Hash, equal_to<_Tp>, _Allocator>;
#endif
diff --git a/libcxx/include/vector b/libcxx/include/vector
index fac1f95d7c523..ad4d2b1de248c 100644
--- a/libcxx/include/vector
+++ b/libcxx/include/vector
@@ -954,14 +954,14 @@ private:
#if _LIBCPP_STD_VER >= 17
template<class _InputIterator,
class _Alloc = allocator<__iter_value_type<_InputIterator>>,
- class = _EnableIf<__is_allocator<_Alloc>::value>
+ class = enable_if_t<__is_allocator<_Alloc>::value>
>
vector(_InputIterator, _InputIterator)
-> vector<__iter_value_type<_InputIterator>, _Alloc>;
template<class _InputIterator,
class _Alloc,
- class = _EnableIf<__is_allocator<_Alloc>::value>
+ class = enable_if_t<__is_allocator<_Alloc>::value>
>
vector(_InputIterator, _InputIterator, _Alloc)
-> vector<__iter_value_type<_InputIterator>, _Alloc>;
More information about the libcxx-commits
mailing list