Bug 1625138 - Part 21: Replace mozilla::IsFunction with std::is_function. r=froydnj

Differential Revision: https://phabricator.services.mozilla.com/D68376

--HG--
extra : moz-landing-system : lando
This commit is contained in:
André Bargull 2020-03-28 13:57:16 +00:00
Родитель 0731a50d34
Коммит 85dfbced09
3 изменённых файлов: 1 добавлений и 35 удалений

Просмотреть файл

@ -426,7 +426,7 @@ struct AssertionConditionType {
static_assert(!IsArray<ValueT>::value,
"Expected boolean assertion condition, got an array or a "
"string!");
static_assert(!IsFunction<ValueT>::value,
static_assert(!std::is_function_v<ValueT>,
"Expected boolean assertion condition, got a function! Did "
"you intend to call that function?");
static_assert(!std::is_floating_point_v<ValueT>,

Просмотреть файл

@ -103,34 +103,6 @@ struct IsArrayHelper<T[]> : TrueType {};
template <typename T>
struct IsArray : detail::IsArrayHelper<typename RemoveCV<T>::Type> {};
namespace detail {
template <typename T>
struct IsFunPtr;
template <typename>
struct IsFunPtr : public FalseType {};
template <typename Result, typename... ArgTypes>
struct IsFunPtr<Result (*)(ArgTypes...)> : public TrueType {};
}; // namespace detail
/**
* IsFunction determines whether a type is a function type. Function pointers
* don't qualify here--only the type of an actual function symbol. We do not
* correctly handle varags function types because of a bug in MSVC.
*
* Given the function:
* void f(int) {}
*
* mozilla::IsFunction<void(int)> is true;
* mozilla::IsFunction<void(*)(int)> is false;
* mozilla::IsFunction<decltype(f)> is true.
*/
template <typename T>
struct IsFunction : public detail::IsFunPtr<typename RemoveCV<T>::Type*> {};
/* 20.9.4.3 Type properties [meta.unary.prop] */
/**

Просмотреть файл

@ -12,15 +12,9 @@ using mozilla::DeclVal;
using mozilla::IsArray;
using mozilla::IsConvertible;
using mozilla::IsDestructible;
using mozilla::IsFunction;
using mozilla::IsSame;
using mozilla::RemovePointer;
static_assert(!IsFunction<int>::value, "int is not a function type");
static_assert(IsFunction<void(int)>::value, "void(int) is a function type");
static_assert(!IsFunction<void (*)(int)>::value,
"void(*)(int) is not a function type");
static_assert(!IsArray<bool>::value, "bool not an array");
static_assert(IsArray<bool[]>::value, "bool[] is an array");
static_assert(IsArray<bool[5]>::value, "bool[5] is an array");