Bug 1625138 - Part 18: Replace mozilla::AddPointer with std::add_pointer. r=froydnj

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

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

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

@ -27,6 +27,7 @@
#include <cstring>
#include <iterator>
#include <limits>
#include <type_traits>
#include <utility>
#include "mozilla/Array.h"
@ -76,8 +77,6 @@ template <class T>
using remove_const_t = typename mozilla::RemoveConst<T>::Type;
template <bool B, class T, class F>
using conditional_t = typename mozilla::Conditional<B, T, F>::Type;
template <class T>
using add_pointer_t = typename mozilla::AddPointer<T>::Type;
template <bool B, class T = void>
using enable_if_t = typename mozilla::EnableIf<B, T>::Type;
@ -122,7 +121,7 @@ class span_iterator {
using difference_type = typename Span::index_type;
using reference = conditional_t<IsConst, const element_type_, element_type_>&;
using pointer = add_pointer_t<reference>;
using pointer = std::add_pointer_t<reference>;
constexpr span_iterator() : span_iterator(nullptr, 0) {}

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

@ -476,21 +476,6 @@ template <typename T>
struct RemovePointer
: detail::RemovePointerHelper<T, typename RemoveCV<T>::Type> {};
/**
* Converts T& to T*. Otherwise returns T* given T. Note that C++17 wants
* std::add_pointer to work differently for function types. We don't implement
* that behavior here.
*
* mozilla::AddPointer<int> is int*;
* mozilla::AddPointer<int*> is int**;
* mozilla::AddPointer<int&> is int*;
* mozilla::AddPointer<int* const> is int** const.
*/
template <typename T>
struct AddPointer {
typedef typename RemoveReference<T>::Type* Type;
};
/* 20.9.7.6 Other transformations [meta.trans.other] */
/**

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

@ -7,7 +7,6 @@
#include "mozilla/Assertions.h"
#include "mozilla/TypeTraits.h"
using mozilla::AddPointer;
using mozilla::AddRvalueReference;
using mozilla::DeclVal;
using mozilla::IsArray;
@ -157,17 +156,6 @@ static_assert(IsSame<RemovePointer<bool TestRemovePointer::*>::Type,
bool TestRemovePointer::*>::value,
"removing pointer from bool S::* must return bool S::*");
static_assert(IsSame<AddPointer<int>::Type, int*>::value,
"adding pointer to int must return int*");
static_assert(IsSame<AddPointer<int*>::Type, int**>::value,
"adding pointer to int* must return int**");
static_assert(IsSame<AddPointer<int&>::Type, int*>::value,
"adding pointer to int& must return int*");
static_assert(IsSame<AddPointer<int* const>::Type, int* const*>::value,
"adding pointer to int* const must return int* const*");
static_assert(IsSame<AddPointer<int* volatile>::Type, int* volatile*>::value,
"adding pointer to int* volatile must return int* volatile*");
/*
* 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)