зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1400307 - handle char32_t in TypeTraits.h; r=froydnj
This adds a couple of missing char32_t specializations to TypeTraits.h, and adds a few extra type traits tests besides. MozReview-Commit-ID: 7aIJbZ2Ppka --HG-- extra : rebase_source : 39ba985c4cc7ced3c667c6fc32c015e0389b1fd2
This commit is contained in:
Родитель
9410972047
Коммит
392d3c2d42
|
@ -99,6 +99,7 @@ template<> struct IsIntegralHelper<unsigned long long> : TrueType {};
|
|||
template<> struct IsIntegralHelper<bool> : TrueType {};
|
||||
template<> struct IsIntegralHelper<wchar_t> : TrueType {};
|
||||
template<> struct IsIntegralHelper<char16_t> : TrueType {};
|
||||
template<> struct IsIntegralHelper<char32_t> : TrueType {};
|
||||
|
||||
} /* namespace detail */
|
||||
|
||||
|
@ -440,6 +441,7 @@ template<> struct IsPod<float> : TrueType {};
|
|||
template<> struct IsPod<double> : TrueType {};
|
||||
template<> struct IsPod<wchar_t> : TrueType {};
|
||||
template<> struct IsPod<char16_t> : TrueType {};
|
||||
template<> struct IsPod<char32_t> : TrueType {};
|
||||
template<typename T> struct IsPod<T*> : TrueType {};
|
||||
|
||||
namespace detail {
|
||||
|
|
|
@ -26,7 +26,9 @@ using mozilla::IsConvertible;
|
|||
using mozilla::IsDefaultConstructible;
|
||||
using mozilla::IsDestructible;
|
||||
using mozilla::IsEmpty;
|
||||
using mozilla::IsIntegral;
|
||||
using mozilla::IsLvalueReference;
|
||||
using mozilla::IsPod;
|
||||
using mozilla::IsPointer;
|
||||
using mozilla::IsReference;
|
||||
using mozilla::IsRvalueReference;
|
||||
|
@ -52,6 +54,39 @@ static_assert(IsArray<bool[]>::value,
|
|||
static_assert(IsArray<bool[5]>::value,
|
||||
"bool[5] is an array");
|
||||
|
||||
static_assert(IsIntegral<char16_t>::value,
|
||||
"char16_t is integral");
|
||||
static_assert(IsIntegral<char32_t>::value,
|
||||
"char32_t is integral");
|
||||
static_assert(!IsIntegral<char&>::value,
|
||||
"char& is not integral");
|
||||
static_assert(!IsIntegral<double>::value,
|
||||
"double is not integral");
|
||||
|
||||
static_assert(IsPod<bool>::value,
|
||||
"bool is pod");
|
||||
static_assert(IsPod<char16_t>::value,
|
||||
"char16_t is pod");
|
||||
static_assert(IsPod<char32_t>::value,
|
||||
"char32_t is pod");
|
||||
struct YepItsAPod { int x; };
|
||||
static_assert(!IsPod<YepItsAPod>::value,
|
||||
"pod struct is pod");
|
||||
struct NopeItsNotAPod {
|
||||
int x;
|
||||
protected:
|
||||
int y;
|
||||
};
|
||||
static_assert(!IsPod<NopeItsNotAPod>::value,
|
||||
"non-standard-layout struct is not pod");
|
||||
struct NopeStillNotAPod {
|
||||
NopeStillNotAPod() : x(7) { }
|
||||
int x;
|
||||
};
|
||||
static_assert(!IsPod<NopeStillNotAPod>::value,
|
||||
"struct with constructor is not pod");
|
||||
|
||||
|
||||
static_assert(!IsPointer<bool>::value,
|
||||
"bool not a pointer");
|
||||
static_assert(IsPointer<bool*>::value,
|
||||
|
|
Загрузка…
Ссылка в новой задаче