зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1625138 - Part 7: Replace mozilla::IsScalar with std::is_scalar. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D68361 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
086c1b8be3
Коммит
be0f9ade3d
|
@ -288,19 +288,6 @@ template <typename T>
|
|||
struct IsMemberPointer
|
||||
: detail::IsMemberPointerHelper<typename RemoveCV<T>::Type> {};
|
||||
|
||||
/**
|
||||
* IsScalar determines whether a type is a scalar type.
|
||||
*
|
||||
* mozilla::IsScalar<int>::value is true
|
||||
* mozilla::IsScalar<int*>::value is true
|
||||
* mozilla::IsScalar<cls>::value is false
|
||||
*/
|
||||
template <typename T>
|
||||
struct IsScalar
|
||||
: IntegralConstant<bool, IsArithmetic<T>::value || IsEnum<T>::value ||
|
||||
IsPointer<T>::value ||
|
||||
IsMemberPointer<T>::value> {};
|
||||
|
||||
/* 20.9.4.3 Type properties [meta.unary.prop] */
|
||||
|
||||
/**
|
||||
|
|
|
@ -86,45 +86,6 @@ TEST_IS_NOT_MEMBER_POINTER(int*)
|
|||
|
||||
} // namespace CPlusPlus11IsMemberPointer
|
||||
|
||||
namespace CPlusPlus11IsScalar {
|
||||
|
||||
using mozilla::IsScalar;
|
||||
|
||||
enum E {};
|
||||
enum class EC {};
|
||||
class C {};
|
||||
struct S {};
|
||||
union U {};
|
||||
|
||||
#define ASSERT_IS_SCALAR(type, msg) \
|
||||
static_assert(IsScalar<type>::value, #type msg);
|
||||
#define TEST_IS_SCALAR(type) \
|
||||
TEST_CV_QUALIFIERS(ASSERT_IS_SCALAR, type, " is a scalar type")
|
||||
|
||||
TEST_IS_SCALAR(int)
|
||||
TEST_IS_SCALAR(float)
|
||||
TEST_IS_SCALAR(E)
|
||||
TEST_IS_SCALAR(EC)
|
||||
TEST_IS_SCALAR(S*)
|
||||
TEST_IS_SCALAR(int S::*)
|
||||
|
||||
#undef TEST_IS_SCALAR
|
||||
#undef ASSERT_IS_SCALAR
|
||||
|
||||
#define ASSERT_IS_NOT_SCALAR(type, msg) \
|
||||
static_assert(!IsScalar<type>::value, #type msg);
|
||||
#define TEST_IS_NOT_SCALAR(type) \
|
||||
TEST_CV_QUALIFIERS(ASSERT_IS_NOT_SCALAR, type, " is not a scalar type")
|
||||
|
||||
TEST_IS_NOT_SCALAR(C)
|
||||
TEST_IS_NOT_SCALAR(S)
|
||||
TEST_IS_NOT_SCALAR(U)
|
||||
|
||||
#undef TEST_IS_NOT_SCALAR
|
||||
#undef ASSERT_IS_NOT_SCALAR
|
||||
|
||||
} // namespace CPlusPlus11IsScalar
|
||||
|
||||
static_assert(!IsSigned<bool>::value, "bool shouldn't be signed");
|
||||
static_assert(IsUnsigned<bool>::value, "bool should be unsigned");
|
||||
|
||||
|
|
|
@ -7,9 +7,10 @@
|
|||
#ifndef nsAutoPtr_h
|
||||
#define nsAutoPtr_h
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/TypeTraits.h"
|
||||
|
||||
#include "nsCycleCollectionNoteChild.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
|
@ -21,7 +22,7 @@
|
|||
template <class T>
|
||||
class nsAutoPtr {
|
||||
private:
|
||||
static_assert(!mozilla::IsScalar<T>::value,
|
||||
static_assert(!std::is_scalar_v<T>,
|
||||
"If you are using "
|
||||
"nsAutoPtr to hold an array, use UniquePtr<T[]> instead");
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче