Commit c3dd651c authored by Victor Zverovich's avatar Victor Zverovich Committed by Facebook Github Bot

Replace `_t<enable_if<...>>` with `enable_if_t<...>`

Summary:
Since we require C++14 in Folly and use `std::enable_if_t` in some places, there
is no need for the `_t` workaround. Replace `_t<enable_if<...>>` with
`enable_if_t<...>`.

Reviewed By: yfeldblum

Differential Revision: D13511564

fbshipit-source-id: 314b4a63281ce6b8275174ae89fab5fba1101bfb
parent f2074bfe
...@@ -52,7 +52,7 @@ FOLLY_GCC_DISABLE_NEW_SHADOW_WARNINGS ...@@ -52,7 +52,7 @@ FOLLY_GCC_DISABLE_NEW_SHADOW_WARNINGS
namespace folly { namespace folly {
#define FOLLY_REQUIRES_DEF(...) \ #define FOLLY_REQUIRES_DEF(...) \
_t<std::enable_if<static_cast<bool>(__VA_ARGS__), long>> std::enable_if_t<static_cast<bool>(__VA_ARGS__), long>
#define FOLLY_REQUIRES(...) FOLLY_REQUIRES_DEF(__VA_ARGS__) = __LINE__ #define FOLLY_REQUIRES(...) FOLLY_REQUIRES_DEF(__VA_ARGS__) = __LINE__
......
...@@ -80,21 +80,21 @@ class Indestructible final { ...@@ -80,21 +80,21 @@ class Indestructible final {
*/ */
template < template <
typename U = T, typename U = T,
_t<std::enable_if<std::is_constructible<T, U&&>::value>>* = nullptr, std::enable_if_t<std::is_constructible<T, U&&>::value>* = nullptr,
_t<std::enable_if< std::enable_if_t<
!std::is_same<Indestructible<T>, remove_cvref_t<U>>::value>>* = !std::is_same<Indestructible<T>, remove_cvref_t<U>>::value>* =
nullptr, nullptr,
_t<std::enable_if<!std::is_convertible<U&&, T>::value>>* = nullptr> std::enable_if_t<!std::is_convertible<U&&, T>::value>* = nullptr>
explicit constexpr Indestructible(U&& u) noexcept( explicit constexpr Indestructible(U&& u) noexcept(
noexcept(T(std::declval<U>()))) noexcept(T(std::declval<U>())))
: storage_(std::forward<U>(u)) {} : storage_(std::forward<U>(u)) {}
template < template <
typename U = T, typename U = T,
_t<std::enable_if<std::is_constructible<T, U&&>::value>>* = nullptr, std::enable_if_t<std::is_constructible<T, U&&>::value>* = nullptr,
_t<std::enable_if< std::enable_if_t<
!std::is_same<Indestructible<T>, remove_cvref_t<U>>::value>>* = !std::is_same<Indestructible<T>, remove_cvref_t<U>>::value>* =
nullptr, nullptr,
_t<std::enable_if<std::is_convertible<U&&, T>::value>>* = nullptr> std::enable_if_t<std::is_convertible<U&&, T>::value>* = nullptr>
/* implicit */ constexpr Indestructible(U&& u) noexcept( /* implicit */ constexpr Indestructible(U&& u) noexcept(
noexcept(T(std::declval<U>()))) noexcept(T(std::declval<U>())))
: storage_(std::forward<U>(u)) {} : storage_(std::forward<U>(u)) {}
......
...@@ -476,7 +476,7 @@ class AlignedSysAllocator : private Align { ...@@ -476,7 +476,7 @@ class AlignedSysAllocator : private Align {
// TODO: remove this ctor, which is required only by gcc49 // TODO: remove this ctor, which is required only by gcc49
template < template <
typename S = Align, typename S = Align,
_t<std::enable_if<std::is_default_constructible<S>::value, int>> = 0> std::enable_if_t<std::is_default_constructible<S>::value, int> = 0>
constexpr AlignedSysAllocator() noexcept(noexcept(Align())) : Align() {} constexpr AlignedSysAllocator() noexcept(noexcept(Align())) : Align() {}
template <typename U> template <typename U>
......
...@@ -60,9 +60,7 @@ class ThreadLocal { ...@@ -60,9 +60,7 @@ class ThreadLocal {
public: public:
constexpr ThreadLocal() : constructor_([]() { return new T(); }) {} constexpr ThreadLocal() : constructor_([]() { return new T(); }) {}
template < template <typename F, std::enable_if_t<is_invocable_r<T*, F>::value, int> = 0>
typename F,
_t<std::enable_if<is_invocable_r<T*, F>::value, int>> = 0>
explicit ThreadLocal(F&& constructor) explicit ThreadLocal(F&& constructor)
: constructor_(std::forward<F>(constructor)) {} : constructor_(std::forward<F>(constructor)) {}
......
...@@ -69,39 +69,39 @@ class propagate_const { ...@@ -69,39 +69,39 @@ class propagate_const {
template < template <
typename OtherPointer, typename OtherPointer,
_t<std::enable_if< std::enable_if_t<
std::is_constructible<Pointer, OtherPointer&&>::value && std::is_constructible<Pointer, OtherPointer&&>::value &&
!std::is_convertible<OtherPointer&&, Pointer>::value, !std::is_convertible<OtherPointer&&, Pointer>::value,
int>> = 0> int> = 0>
constexpr explicit propagate_const(propagate_const<OtherPointer>&& other) constexpr explicit propagate_const(propagate_const<OtherPointer>&& other)
: pointer_(static_cast<OtherPointer&&>(other.pointer_)) {} : pointer_(static_cast<OtherPointer&&>(other.pointer_)) {}
template < template <
typename OtherPointer, typename OtherPointer,
_t<std::enable_if< std::enable_if_t<
std::is_constructible<Pointer, OtherPointer&&>::value && std::is_constructible<Pointer, OtherPointer&&>::value &&
std::is_convertible<OtherPointer&&, Pointer>::value, std::is_convertible<OtherPointer&&, Pointer>::value,
int>> = 0> int> = 0>
constexpr propagate_const(propagate_const<OtherPointer>&& other) constexpr propagate_const(propagate_const<OtherPointer>&& other)
: pointer_(static_cast<OtherPointer&&>(other.pointer_)) {} : pointer_(static_cast<OtherPointer&&>(other.pointer_)) {}
template < template <
typename OtherPointer, typename OtherPointer,
_t<std::enable_if< std::enable_if_t<
!detail::is_decay_propagate_const<OtherPointer>::value && !detail::is_decay_propagate_const<OtherPointer>::value &&
std::is_constructible<Pointer, OtherPointer&&>::value && std::is_constructible<Pointer, OtherPointer&&>::value &&
!std::is_convertible<OtherPointer&&, Pointer>::value, !std::is_convertible<OtherPointer&&, Pointer>::value,
int>> = 0> int> = 0>
constexpr explicit propagate_const(OtherPointer&& other) constexpr explicit propagate_const(OtherPointer&& other)
: pointer_(static_cast<OtherPointer&&>(other)) {} : pointer_(static_cast<OtherPointer&&>(other)) {}
template < template <
typename OtherPointer, typename OtherPointer,
_t<std::enable_if< std::enable_if_t<
!detail::is_decay_propagate_const<OtherPointer>::value && !detail::is_decay_propagate_const<OtherPointer>::value &&
std::is_constructible<Pointer, OtherPointer&&>::value && std::is_constructible<Pointer, OtherPointer&&>::value &&
std::is_convertible<OtherPointer&&, Pointer>::value, std::is_convertible<OtherPointer&&, Pointer>::value,
int>> = 0> int> = 0>
constexpr propagate_const(OtherPointer&& other) constexpr propagate_const(OtherPointer&& other)
: pointer_(static_cast<OtherPointer&&>(other)) {} : pointer_(static_cast<OtherPointer&&>(other)) {}
...@@ -119,9 +119,9 @@ class propagate_const { ...@@ -119,9 +119,9 @@ class propagate_const {
template < template <
typename OtherPointer, typename OtherPointer,
typename = _t<std::enable_if< typename = std::enable_if_t<
!detail::is_decay_propagate_const<OtherPointer>::value && !detail::is_decay_propagate_const<OtherPointer>::value &&
std::is_convertible<OtherPointer&&, Pointer>::value>>> std::is_convertible<OtherPointer&&, Pointer>::value>>
FOLLY_CPP14_CONSTEXPR propagate_const& operator=(OtherPointer&& other) { FOLLY_CPP14_CONSTEXPR propagate_const& operator=(OtherPointer&& other) {
pointer_ = static_cast<OtherPointer&&>(other); pointer_ = static_cast<OtherPointer&&>(other);
return *this; return *this;
...@@ -164,18 +164,18 @@ class propagate_const { ...@@ -164,18 +164,18 @@ class propagate_const {
template < template <
typename OtherPointer = Pointer, typename OtherPointer = Pointer,
typename = _t<std::enable_if< typename = std::enable_if_t<
std::is_pointer<OtherPointer>::value || std::is_pointer<OtherPointer>::value ||
std::is_convertible<OtherPointer, element_type*>::value>>> std::is_convertible<OtherPointer, element_type*>::value>>
FOLLY_CPP14_CONSTEXPR operator element_type*() { FOLLY_CPP14_CONSTEXPR operator element_type*() {
return get(); return get();
} }
template < template <
typename OtherPointer = Pointer, typename OtherPointer = Pointer,
typename = _t<std::enable_if< typename = std::enable_if_t<
std::is_pointer<OtherPointer>::value || std::is_pointer<OtherPointer>::value ||
std::is_convertible<OtherPointer, element_type const*>::value>>> std::is_convertible<OtherPointer, element_type const*>::value>>
constexpr operator element_type const*() const { constexpr operator element_type const*() const {
return get(); return get();
} }
......
...@@ -472,15 +472,13 @@ class Histogram { ...@@ -472,15 +472,13 @@ class Histogram {
}; };
private: private:
template < template <typename S, typename = std::enable_if_t<std::is_integral<S>::value>>
typename S,
typename = _t<std::enable_if<std::is_integral<S>::value>>>
static constexpr _t<std::make_unsigned<S>> to_unsigned(S s) { static constexpr _t<std::make_unsigned<S>> to_unsigned(S s) {
return static_cast<_t<std::make_unsigned<S>>>(s); return static_cast<_t<std::make_unsigned<S>>>(s);
} }
template < template <
typename S, typename S,
typename = _t<std::enable_if<!std::is_integral<S>::value>>> typename = std::enable_if_t<!std::is_integral<S>::value>>
static constexpr S to_unsigned(S s) { static constexpr S to_unsigned(S s) {
return s; return s;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment