зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1625138 - Part 28: Replace mozilla::AddRvalueReference with std::add_rvalue_reference. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D68546 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
42d4ebbda9
Коммит
95c76a6863
|
@ -219,45 +219,6 @@ struct RemoveCV {
|
|||
typedef typename RemoveConst<typename RemoveVolatile<T>::Type>::Type Type;
|
||||
};
|
||||
|
||||
/* 20.9.7.2 Reference modifications [meta.trans.ref] */
|
||||
|
||||
namespace detail {
|
||||
|
||||
enum Voidness { TIsVoid, TIsNotVoid };
|
||||
|
||||
template <typename T, Voidness V = IsVoid<T>::value ? TIsVoid : TIsNotVoid>
|
||||
struct AddRvalueReferenceHelper;
|
||||
|
||||
template <typename T>
|
||||
struct AddRvalueReferenceHelper<T, TIsVoid> {
|
||||
typedef void Type;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct AddRvalueReferenceHelper<T, TIsNotVoid> {
|
||||
typedef T&& Type;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
/**
|
||||
* AddRvalueReference adds an rvalue && reference to T if one isn't already
|
||||
* present. (Note: adding an rvalue reference to an lvalue & reference in
|
||||
* essence keeps the &, per C+11 reference collapsing rules. For example,
|
||||
* int& would remain int&.)
|
||||
*
|
||||
* The final computed type will only *not* be a reference if T is void.
|
||||
*
|
||||
* mozilla::AddRvalueReference<int>::Type is int&&;
|
||||
* mozilla::AddRvalueRference<volatile int&>::Type is volatile int&;
|
||||
* mozilla::AddRvalueRference<const int&&>::Type is const int&&;
|
||||
* mozilla::AddRvalueReference<void*>::Type is void*&&;
|
||||
* mozilla::AddRvalueReference<void>::Type is void;
|
||||
* mozilla::AddRvalueReference<struct S&>::Type is struct S&.
|
||||
*/
|
||||
template <typename T>
|
||||
struct AddRvalueReference : detail::AddRvalueReferenceHelper<T> {};
|
||||
|
||||
} /* namespace mozilla */
|
||||
|
||||
#endif /* mozilla_TypeTraits_h */
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/TypeTraits.h"
|
||||
|
||||
using mozilla::AddRvalueReference;
|
||||
using mozilla::IsDestructible;
|
||||
using mozilla::IsSame;
|
||||
|
||||
|
@ -28,20 +27,6 @@ static_assert(!IsDestructible<PrivateDestructible>::value,
|
|||
static_assert(IsDestructible<TrivialDestructible>::value,
|
||||
"trivial destructible class is destructible");
|
||||
|
||||
static_assert(IsSame<AddRvalueReference<int>::Type, int&&>::value,
|
||||
"not adding && to int correctly");
|
||||
static_assert(
|
||||
IsSame<AddRvalueReference<volatile int&>::Type, volatile int&>::value,
|
||||
"not adding && to volatile int& correctly");
|
||||
static_assert(IsSame<AddRvalueReference<const int&&>::Type, const int&&>::value,
|
||||
"not adding && to volatile int& correctly");
|
||||
static_assert(IsSame<AddRvalueReference<void*>::Type, void*&&>::value,
|
||||
"not adding && to void* correctly");
|
||||
static_assert(IsSame<AddRvalueReference<void>::Type, void>::value,
|
||||
"void shouldn't be transformed by AddRvalueReference");
|
||||
static_assert(IsSame<AddRvalueReference<struct S1&>::Type, struct S1&>::value,
|
||||
"not reference-collapsing struct S1& && to struct S1& correctly");
|
||||
|
||||
/*
|
||||
* Android's broken [u]intptr_t inttype macros are broken because its PRI*PTR
|
||||
* macros are defined as "ld", but sizeof(long) is 8 and sizeof(intptr_t)
|
||||
|
|
Загрузка…
Ссылка в новой задаче