0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-15 11:36:00 -05:00

refactor: remove references to deprecated values under std::allocator

Includes allocator::pointer, allocator::const_pointer, allocator::reference and allocator::const_reference which are deprecated in c++17 and removed in c++20. See https://en.cppreference.com/w/cpp/memory/allocator

Also prefer `using` over `typedef` see: https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rt-using
This commit is contained in:
Pasta 2021-10-04 22:49:21 -04:00 committed by pasta
parent 991753e4d5
commit ea4b61a157
2 changed files with 15 additions and 18 deletions

View file

@ -9,6 +9,7 @@
#include <support/lockedpool.h> #include <support/lockedpool.h>
#include <support/cleanse.h> #include <support/cleanse.h>
#include <memory>
#include <string> #include <string>
// //
@ -17,15 +18,13 @@
// //
template <typename T> template <typename T>
struct secure_allocator : public std::allocator<T> { struct secure_allocator : public std::allocator<T> {
// MSVC8 default copy constructor is broken using base = std::allocator<T>;
typedef std::allocator<T> base; using traits = std::allocator_traits<base>;
typedef typename base::size_type size_type; using size_type = typename traits::size_type;
typedef typename base::difference_type difference_type; using difference_type = typename traits::difference_type;
typedef typename base::pointer pointer; using pointer = typename traits::pointer;
typedef typename base::const_pointer const_pointer; using const_pointer = typename traits::const_pointer;
typedef typename base::reference reference; using value_type = typename traits::value_type;
typedef typename base::const_reference const_reference;
typedef typename base::value_type value_type;
secure_allocator() noexcept {} secure_allocator() noexcept {}
secure_allocator(const secure_allocator& a) noexcept : base(a) {} secure_allocator(const secure_allocator& a) noexcept : base(a) {}
template <typename U> template <typename U>

View file

@ -13,15 +13,13 @@
template <typename T> template <typename T>
struct zero_after_free_allocator : public std::allocator<T> { struct zero_after_free_allocator : public std::allocator<T> {
// MSVC8 default copy constructor is broken using base = std::allocator<T>;
typedef std::allocator<T> base; using traits = std::allocator_traits<base>;
typedef typename base::size_type size_type; using size_type = typename traits::size_type;
typedef typename base::difference_type difference_type; using difference_type = typename traits::difference_type;
typedef typename base::pointer pointer; using pointer = typename traits::pointer;
typedef typename base::const_pointer const_pointer; using const_pointer = typename traits::const_pointer;
typedef typename base::reference reference; using value_type = typename traits::value_type;
typedef typename base::const_reference const_reference;
typedef typename base::value_type value_type;
zero_after_free_allocator() noexcept {} zero_after_free_allocator() noexcept {}
zero_after_free_allocator(const zero_after_free_allocator& a) noexcept : base(a) {} zero_after_free_allocator(const zero_after_free_allocator& a) noexcept : base(a) {}
template <typename U> template <typename U>