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
namespace folly {
#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__
......
......@@ -80,21 +80,21 @@ class Indestructible final {
*/
template <
typename U = T,
_t<std::enable_if<std::is_constructible<T, U&&>::value>>* = nullptr,
_t<std::enable_if<
!std::is_same<Indestructible<T>, remove_cvref_t<U>>::value>>* =
std::enable_if_t<std::is_constructible<T, U&&>::value>* = nullptr,
std::enable_if_t<
!std::is_same<Indestructible<T>, remove_cvref_t<U>>::value>* =
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(
noexcept(T(std::declval<U>())))
: storage_(std::forward<U>(u)) {}
template <
typename U = T,
_t<std::enable_if<std::is_constructible<T, U&&>::value>>* = nullptr,
_t<std::enable_if<
!std::is_same<Indestructible<T>, remove_cvref_t<U>>::value>>* =
std::enable_if_t<std::is_constructible<T, U&&>::value>* = nullptr,
std::enable_if_t<
!std::is_same<Indestructible<T>, remove_cvref_t<U>>::value>* =
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(
noexcept(T(std::declval<U>())))
: storage_(std::forward<U>(u)) {}
......
......@@ -476,7 +476,7 @@ class AlignedSysAllocator : private Align {
// TODO: remove this ctor, which is required only by gcc49
template <
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() {}
template <typename U>
......
......@@ -60,9 +60,7 @@ class ThreadLocal {
public:
constexpr ThreadLocal() : constructor_([]() { return new T(); }) {}
template <
typename F,
_t<std::enable_if<is_invocable_r<T*, F>::value, int>> = 0>
template <typename F, std::enable_if_t<is_invocable_r<T*, F>::value, int> = 0>
explicit ThreadLocal(F&& constructor)
: constructor_(std::forward<F>(constructor)) {}
......
......@@ -69,39 +69,39 @@ class propagate_const {
template <
typename OtherPointer,
_t<std::enable_if<
std::enable_if_t<
std::is_constructible<Pointer, OtherPointer&&>::value &&
!std::is_convertible<OtherPointer&&, Pointer>::value,
int>> = 0>
int> = 0>
constexpr explicit propagate_const(propagate_const<OtherPointer>&& other)
: pointer_(static_cast<OtherPointer&&>(other.pointer_)) {}
template <
typename OtherPointer,
_t<std::enable_if<
std::enable_if_t<
std::is_constructible<Pointer, OtherPointer&&>::value &&
std::is_convertible<OtherPointer&&, Pointer>::value,
int>> = 0>
int> = 0>
constexpr propagate_const(propagate_const<OtherPointer>&& other)
: pointer_(static_cast<OtherPointer&&>(other.pointer_)) {}
template <
typename OtherPointer,
_t<std::enable_if<
std::enable_if_t<
!detail::is_decay_propagate_const<OtherPointer>::value &&
std::is_constructible<Pointer, OtherPointer&&>::value &&
!std::is_convertible<OtherPointer&&, Pointer>::value,
int>> = 0>
int> = 0>
constexpr explicit propagate_const(OtherPointer&& other)
: pointer_(static_cast<OtherPointer&&>(other)) {}
template <
typename OtherPointer,
_t<std::enable_if<
std::enable_if_t<
!detail::is_decay_propagate_const<OtherPointer>::value &&
std::is_constructible<Pointer, OtherPointer&&>::value &&
std::is_convertible<OtherPointer&&, Pointer>::value,
int>> = 0>
int> = 0>
constexpr propagate_const(OtherPointer&& other)
: pointer_(static_cast<OtherPointer&&>(other)) {}
......@@ -119,9 +119,9 @@ class propagate_const {
template <
typename OtherPointer,
typename = _t<std::enable_if<
typename = std::enable_if_t<
!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) {
pointer_ = static_cast<OtherPointer&&>(other);
return *this;
......@@ -164,18 +164,18 @@ class propagate_const {
template <
typename OtherPointer = Pointer,
typename = _t<std::enable_if<
typename = std::enable_if_t<
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*() {
return get();
}
template <
typename OtherPointer = Pointer,
typename = _t<std::enable_if<
typename = std::enable_if_t<
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 {
return get();
}
......
......@@ -472,15 +472,13 @@ class Histogram {
};
private:
template <
typename S,
typename = _t<std::enable_if<std::is_integral<S>::value>>>
template <typename S, typename = std::enable_if_t<std::is_integral<S>::value>>
static constexpr _t<std::make_unsigned<S>> to_unsigned(S s) {
return static_cast<_t<std::make_unsigned<S>>>(s);
}
template <
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) {
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