Issue #1803 - Convert std::*<T>::value/::type to _v and _t suffixes.
This excludes uses in third-party libs in our tree.
This commit is contained in:
13 files changed
+48
-48
No files matched your search
@@ -274,7 +274,7 @@ public:
|
||||
}
|
||||
|
||||
template<typename T,
|
||||
typename = typename std::enable_if<std::is_enum<T>::value>::type>
|
||||
typename = typename std::enable_if_t<std::is_enum_v<T>>>
|
||||
EnumTable(const char* aTag, T aValue)
|
||||
: tag(aTag)
|
||||
, value(static_cast<int16_t>(aValue))
|
||||
|
||||
@@ -8185,7 +8185,7 @@ CodeGenerator::visitStoreElementV(LStoreElementV* lir)
|
||||
template <typename T> void
|
||||
CodeGenerator::emitStoreElementHoleT(T* lir)
|
||||
{
|
||||
static_assert(std::is_same<T, LStoreElementHoleT>::value || std::is_same<T, LFallibleStoreElementT>::value,
|
||||
static_assert(std::is_same_v<T, LStoreElementHoleT> || std::is_same_v<T, LFallibleStoreElementT>,
|
||||
"emitStoreElementHoleT called with unexpected argument type");
|
||||
|
||||
OutOfLineStoreElementHole* ool = new(alloc()) OutOfLineStoreElementHole(lir);
|
||||
@@ -8244,7 +8244,7 @@ CodeGenerator::visitStoreElementHoleT(LStoreElementHoleT* lir)
|
||||
template <typename T> void
|
||||
CodeGenerator::emitStoreElementHoleV(T* lir)
|
||||
{
|
||||
static_assert(std::is_same<T, LStoreElementHoleV>::value || std::is_same<T, LFallibleStoreElementV>::value,
|
||||
static_assert(std::is_same_v<T, LStoreElementHoleV> || std::is_same_v<T, LFallibleStoreElementV>,
|
||||
"emitStoreElementHoleV called with unexpected parameter type");
|
||||
|
||||
OutOfLineStoreElementHole* ool = new(alloc()) OutOfLineStoreElementHole(lir);
|
||||
|
||||
+4
-4
@@ -2871,8 +2871,8 @@ static JSString* ReplaceAll(JSContext* cx, JSLinearString* str,
|
||||
|
||||
// Step 13.
|
||||
StringBuffer result(cx);
|
||||
if (std::is_same<StrChar, char16_t>::value ||
|
||||
std::is_same<RepChar, char16_t>::value) {
|
||||
if (std::is_same_v<StrChar, char16_t> ||
|
||||
std::is_same_v<RepChar, char16_t>) {
|
||||
if (!result.ensureTwoByteChars()) {
|
||||
return nullptr;
|
||||
}
|
||||
@@ -2954,8 +2954,8 @@ static JSString* ReplaceAllInterleave(JSContext* cx, JSLinearString* str,
|
||||
|
||||
// Step 13.
|
||||
StringBuffer result(cx);
|
||||
if (std::is_same<StrChar, char16_t>::value ||
|
||||
std::is_same<RepChar, char16_t>::value) {
|
||||
if (std::is_same_v<StrChar, char16_t> ||
|
||||
std::is_same_v<RepChar, char16_t>) {
|
||||
if (!result.ensureTwoByteChars()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -309,26 +309,26 @@ InflateUTF8StringToBuffer(ContextT* cx, const UTF8Chars src, CharT* dst, size_t*
|
||||
while (v & (0x80 >> n))
|
||||
n++;
|
||||
|
||||
#define INVALID(report, arg, n2) \
|
||||
do { \
|
||||
if (Action == CountAndReportInvalids) { \
|
||||
report(cx, arg); \
|
||||
return false; \
|
||||
} else if (Action == AssertNoInvalids) { \
|
||||
MOZ_CRASH("invalid UTF-8 string: " # report); \
|
||||
} else { \
|
||||
if (Action == Copy) { \
|
||||
if (std::is_same<decltype(dst[0]), Latin1Char>::value) \
|
||||
dst[j] = CharT(REPLACE_UTF8_LATIN1); \
|
||||
else \
|
||||
dst[j] = CharT(REPLACE_UTF8); \
|
||||
} else { \
|
||||
MOZ_ASSERT(Action == CountAndIgnoreInvalids || \
|
||||
Action == FindEncoding); \
|
||||
} \
|
||||
n = n2; \
|
||||
goto invalidMultiByteCodeUnit; \
|
||||
} \
|
||||
#define INVALID(report, arg, n2) \
|
||||
do { \
|
||||
if (Action == CountAndReportInvalids) { \
|
||||
report(cx, arg); \
|
||||
return false; \
|
||||
} else if (Action == AssertNoInvalids) { \
|
||||
MOZ_CRASH("invalid UTF-8 string: " # report); \
|
||||
} else { \
|
||||
if (Action == Copy) { \
|
||||
if (std::is_same_v<decltype(dst[0]), Latin1Char>) \
|
||||
dst[j] = CharT(REPLACE_UTF8_LATIN1); \
|
||||
else \
|
||||
dst[j] = CharT(REPLACE_UTF8); \
|
||||
} else { \
|
||||
MOZ_ASSERT(Action == CountAndIgnoreInvalids || \
|
||||
Action == FindEncoding); \
|
||||
} \
|
||||
n = n2; \
|
||||
goto invalidMultiByteCodeUnit; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
// Check the leading byte.
|
||||
|
||||
+1
-1
@@ -1138,7 +1138,7 @@ class StaticStrings
|
||||
}
|
||||
|
||||
template <typename CharT,
|
||||
typename = typename std::enable_if<!std::is_const<CharT>::value>::type>
|
||||
typename = typename std::enable_if_t<!std::is_const_v<CharT>>>
|
||||
MOZ_ALWAYS_INLINE JSAtom* lookup(CharT* chars, size_t length) {
|
||||
// Collapse the remaining |CharT*| to |const CharT*| to avoid excess
|
||||
// instantiations.
|
||||
|
||||
@@ -677,12 +677,12 @@ class ElementSpecific
|
||||
return true;
|
||||
}
|
||||
|
||||
if (std::is_same<T, int64_t>::value) {
|
||||
if (std::is_same_v<T, int64_t>) {
|
||||
JS_TRY_VAR_OR_RETURN_FALSE(cx, *result, ToBigInt64(cx, v));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (std::is_same<T, uint64_t>::value) {
|
||||
if (std::is_same_v<T, uint64_t>) {
|
||||
JS_TRY_VAR_OR_RETURN_FALSE(cx, *result, ToBigUint64(cx, v));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -489,7 +489,7 @@ public:
|
||||
void SetNoneValue();
|
||||
void SetIntValue(int32_t aInt, Unit aUnit);
|
||||
template<typename T,
|
||||
typename = typename std::enable_if<std::is_enum<T>::value>::type>
|
||||
typename = typename std::enable_if_t<std::is_enum_v<T>>>
|
||||
void SetIntValue(T aInt, Unit aUnit)
|
||||
{
|
||||
static_assert(mozilla::EnumTypeFitsWithin<T, int32_t>::value,
|
||||
|
||||
@@ -364,7 +364,7 @@ public:
|
||||
}
|
||||
|
||||
template<typename T,
|
||||
typename = typename std::enable_if<std::is_enum<T>::value>::type>
|
||||
typename = typename std::enable_if_t<std::is_enum_v<T>>>
|
||||
KTableEntry(nsCSSKeyword aKeyword, T aValue)
|
||||
: mKeyword(aKeyword)
|
||||
, mValue(static_cast<int16_t>(aValue))
|
||||
@@ -451,7 +451,7 @@ public:
|
||||
static nsCSSKeyword ValueToKeywordEnum(int32_t aValue,
|
||||
const KTableEntry aTable[]);
|
||||
template<typename T,
|
||||
typename = typename std::enable_if<std::is_enum<T>::value>::type>
|
||||
typename = typename std::enable_if_t<std::is_enum_v<T>>>
|
||||
static nsCSSKeyword ValueToKeywordEnum(T aValue,
|
||||
const KTableEntry aTable[])
|
||||
{
|
||||
@@ -463,7 +463,7 @@ public:
|
||||
static const nsAFlatCString& ValueToKeyword(int32_t aValue,
|
||||
const KTableEntry aTable[]);
|
||||
template<typename T,
|
||||
typename = typename std::enable_if<std::is_enum<T>::value>::type>
|
||||
typename = typename std::enable_if_t<std::is_enum_v<T>>>
|
||||
static const nsAFlatCString& ValueToKeyword(T aValue,
|
||||
const KTableEntry aTable[])
|
||||
{
|
||||
|
||||
@@ -955,7 +955,7 @@ private:
|
||||
public:
|
||||
void SetIntValue(int32_t aValue, nsCSSUnit aUnit);
|
||||
template<typename T,
|
||||
typename = typename std::enable_if<std::is_enum<T>::value>::type>
|
||||
typename = typename std::enable_if_t<std::is_enum_v<T>>>
|
||||
void SetIntValue(T aValue, nsCSSUnit aUnit)
|
||||
{
|
||||
static_assert(mozilla::EnumTypeFitsWithin<T, int32_t>::value,
|
||||
|
||||
@@ -56,13 +56,13 @@ template<typename T, typename Storage>
|
||||
struct EnumTypeFitsWithin
|
||||
: public detail::EnumFitsWithinHelper<
|
||||
sizeof(T),
|
||||
std::is_signed<typename std::underlying_type<T>::type>::value,
|
||||
std::is_signed_v<typename std::underlying_type_t<T>>,
|
||||
sizeof(Storage),
|
||||
std::is_signed<Storage>::value
|
||||
std::is_signed_v<Storage>
|
||||
>
|
||||
{
|
||||
static_assert(std::is_enum<T>::value, "must provide an enum type");
|
||||
static_assert(std::is_integral<Storage>::value, "must provide an integral type");
|
||||
static_assert(std::is_enum_v<T>, "must provide an enum type");
|
||||
static_assert(std::is_integral_v<Storage>, "must provide an integral type");
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
@@ -31,7 +31,7 @@ template<typename EnumTypeT>
|
||||
class EnumeratedIterator
|
||||
{
|
||||
public:
|
||||
typedef typename std::underlying_type<EnumTypeT>::type IntTypeT;
|
||||
typedef typename std::underlying_type_t<EnumTypeT> IntTypeT;
|
||||
|
||||
template<typename EnumType>
|
||||
explicit EnumeratedIterator(EnumType aCurrent)
|
||||
|
||||
+7
-7
@@ -115,7 +115,7 @@ public:
|
||||
*/
|
||||
template<typename U,
|
||||
typename =
|
||||
typename std::enable_if<std::is_convertible<U, T>::value>::type>
|
||||
typename std::enable_if_t<std::is_convertible_v<U, T>>>
|
||||
MOZ_IMPLICIT
|
||||
Maybe(const Maybe<U>& aOther)
|
||||
: mIsSome(false)
|
||||
@@ -139,7 +139,7 @@ public:
|
||||
*/
|
||||
template<typename U,
|
||||
typename =
|
||||
typename std::enable_if<std::is_convertible<U, T>::value>::type>
|
||||
typename std::enable_if_t<std::is_convertible_v<U, T>>>
|
||||
MOZ_IMPLICIT
|
||||
Maybe(Maybe<U>&& aOther)
|
||||
: mIsSome(false)
|
||||
@@ -168,7 +168,7 @@ public:
|
||||
|
||||
template<typename U,
|
||||
typename =
|
||||
typename std::enable_if<std::is_convertible<U, T>::value>::type>
|
||||
typename std::enable_if_t<std::is_convertible_v<U, T>>>
|
||||
Maybe& operator=(const Maybe<U>& aOther)
|
||||
{
|
||||
if (aOther.isSome()) {
|
||||
@@ -203,7 +203,7 @@ public:
|
||||
|
||||
template<typename U,
|
||||
typename =
|
||||
typename std::enable_if<std::is_convertible<U, T>::value>::type>
|
||||
typename std::enable_if_t<std::is_convertible_v<U, T>>>
|
||||
Maybe& operator=(Maybe<U>&& aOther)
|
||||
{
|
||||
if (aOther.isSome()) {
|
||||
@@ -539,8 +539,8 @@ class Maybe<T&> {
|
||||
* reference value, you need to use emplace() instead.
|
||||
*/
|
||||
template<typename T,
|
||||
typename U = typename std::remove_cv<
|
||||
typename std::remove_reference<T>::type>::type>
|
||||
typename U = typename std::remove_cv_t<
|
||||
typename std::remove_reference_t<T>>>
|
||||
Maybe<U>
|
||||
Some(T&& aValue)
|
||||
{
|
||||
@@ -574,7 +574,7 @@ ToMaybe(T* aPtr)
|
||||
template<typename T> bool
|
||||
operator==(const Maybe<T>& aLHS, const Maybe<T>& aRHS)
|
||||
{
|
||||
static_assert(!std::is_reference<T>::value,
|
||||
static_assert(!std::is_reference_v<T>,
|
||||
"operator== is not defined for Maybe<T&>, compare values or "
|
||||
"addresses explicitly instead");
|
||||
if (aLHS.isNothing() != aRHS.isNothing()) {
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ public:
|
||||
explicit SaturateOp(T& aValue)
|
||||
: mValue(aValue)
|
||||
{
|
||||
// We should actually check for |std::is_scalar<T>::value| to be
|
||||
// We should actually check for |std::is_scalar_v<T>| to be
|
||||
// true, but this type trait is not available everywhere. Relax
|
||||
// this assertion if you want to use floating point values as well.
|
||||
static_assert(IsIntegral<T>::value,
|
||||
|
||||
Reference in new issue
Block a user