<xmemory>: remove deprecated std::allocator members in C++20 (#1585)

This commit is contained in:
Michael S. Rizkalla 2021-02-02 03:35:06 +00:00 коммит произвёл GitHub
Родитель 6779b613e1
Коммит d1f6fe969f
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
5 изменённых файлов: 21 добавлений и 2 удалений

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

@ -788,16 +788,20 @@ public:
using value_type = _Ty;
#if _HAS_DEPRECATED_ALLOCATOR_MEMBERS
_CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS typedef _Ty* pointer;
_CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS typedef const _Ty* const_pointer;
_CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS typedef _Ty& reference;
_CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS typedef const _Ty& const_reference;
#endif // _HAS_DEPRECATED_ALLOCATOR_MEMBERS
using size_type = size_t;
using difference_type = ptrdiff_t;
using propagate_on_container_move_assignment = true_type;
using propagate_on_container_move_assignment = true_type;
#if _HAS_DEPRECATED_ALLOCATOR_MEMBERS
using is_always_equal _CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS = true_type;
template <class _Other>
@ -812,6 +816,7 @@ public:
_CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS _NODISCARD const _Ty* address(const _Ty& _Val) const noexcept {
return _STD addressof(_Val);
}
#endif // _HAS_DEPRECATED_ALLOCATOR_MEMBERS
constexpr allocator() noexcept {}
@ -830,6 +835,7 @@ public:
return static_cast<_Ty*>(_Allocate<_New_alignof<_Ty>>(_Get_size_of_n<sizeof(_Ty)>(_Count)));
}
#if _HAS_DEPRECATED_ALLOCATOR_MEMBERS
_CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS _NODISCARD __declspec(allocator) _Ty* allocate(
_CRT_GUARDOVERFLOW const size_t _Count, const void*) {
return allocate(_Count);
@ -848,6 +854,7 @@ public:
_CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS _NODISCARD size_t max_size() const noexcept {
return static_cast<size_t>(-1) / sizeof(_Ty);
}
#endif // _HAS_DEPRECATED_ALLOCATOR_MEMBERS
};
// CLASS allocator<void>
@ -855,19 +862,24 @@ template <>
class allocator<void> {
public:
using value_type = void;
#if _HAS_DEPRECATED_ALLOCATOR_MEMBERS
_CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS typedef void* pointer;
_CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS typedef const void* const_pointer;
#endif // _HAS_DEPRECATED_ALLOCATOR_MEMBERS
using size_type = size_t;
using difference_type = ptrdiff_t;
using propagate_on_container_move_assignment = true_type;
using propagate_on_container_move_assignment = true_type;
#if _HAS_DEPRECATED_ALLOCATOR_MEMBERS
using is_always_equal _CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS = true_type;
template <class _Other>
struct _CXX17_DEPRECATE_OLD_ALLOCATOR_MEMBERS rebind {
using other = allocator<_Other>;
};
#endif // _HAS_DEPRECATED_ALLOCATOR_MEMBERS
};
template <class _Ty, class _Other>

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

@ -1027,6 +1027,10 @@
#define _HAS_DEPRECATED_ADAPTOR_TYPEDEFS (_HAS_FEATURES_REMOVED_IN_CXX20)
#endif // _HAS_DEPRECATED_ADAPTOR_TYPEDEFS
#ifndef _HAS_DEPRECATED_ALLOCATOR_MEMBERS
#define _HAS_DEPRECATED_ALLOCATOR_MEMBERS (_HAS_FEATURES_REMOVED_IN_CXX20)
#endif // _HAS_DEPRECATED_ALLOCATOR_MEMBERS
#ifndef _HAS_DEPRECATED_IS_LITERAL_TYPE
#define _HAS_DEPRECATED_IS_LITERAL_TYPE (_HAS_FEATURES_REMOVED_IN_CXX20)
#endif // _HAS_DEPRECATED_IS_LITERAL_TYPE

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

@ -3,6 +3,7 @@
// Test DevDiv-920385 "<list>: list::sort shouldn't default-construct allocators".
#define _HAS_DEPRECATED_ALLOCATOR_MEMBERS 1
#define _SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING
#include <algorithm>

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

@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#define _HAS_DEPRECATED_ADAPTOR_TYPEDEFS 1
#define _HAS_DEPRECATED_ALLOCATOR_MEMBERS 1
#define _HAS_DEPRECATED_NEGATORS 1
#define _HAS_DEPRECATED_RAW_STORAGE_ITERATOR 1
#define _HAS_DEPRECATED_TEMPORARY_BUFFER 1

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

@ -5,6 +5,7 @@
#define TEST_NAME "<memory>"
#define _HAS_AUTO_PTR_ETC 1
#define _HAS_DEPRECATED_ALLOCATOR_MEMBERS 1
#define _HAS_DEPRECATED_RAW_STORAGE_ITERATOR 1
#define _HAS_DEPRECATED_TEMPORARY_BUFFER 1
#define _SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING