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

pull PastaPastaPasta wants to merge 1 commits into bitcoin:master from PastaPastaPasta:btc-allocator changing 2 files +15 −18
  1. PastaPastaPasta commented at 3:42 AM on October 5, 2021: contributor

    Removes usages of 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 prefers using over typedef see: https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rt-using I'll be happy to revert this if requested so

  2. fanquake added the label Refactoring on Oct 5, 2021
  3. PastaPastaPasta force-pushed on Oct 5, 2021
  4. PastaPastaPasta commented at 3:43 PM on October 5, 2021: contributor

    Win64 native build failure seems unrelated

  5. PastaPastaPasta force-pushed on Oct 7, 2021
  6. PastaPastaPasta commented at 8:07 PM on October 10, 2021: contributor

    Bump, this should be a pretty easy PR for review. CI is now happy, let me know if anything needs to be done

  7. MarcoFalke commented at 7:12 AM on October 11, 2021: member

    I didn't look at the changes, but gcc and clang on my system produce the same bitcoind (with and without this patch).

  8. sophia0898 approved
  9. in src/support/allocators/secure.h:27 in 154f1286ba outdated
      30 | +    using traits = std::allocator_traits<base>;
      31 | +    using size_type = typename traits::size_type;
      32 | +    using difference_type = typename traits::difference_type;
      33 | +    using pointer = typename traits::pointer;
      34 | +    using const_pointer = typename traits::const_pointer;
      35 | +    using value_type = typename traits::value_type;
    


    jonatack commented at 4:36 PM on October 11, 2021:

    It seems the #include <memory> header should be added in this file.

    Any reason for reordering? (The order in https://en.cppreference.com/w/cpp/memory/allocator is different as well.)


    PastaPastaPasta commented at 12:33 AM on October 12, 2021:

    I'd be happy to #include <memory> but does that make sense for this PR? I seem to think not, but lmk if I should add it.

    Otherwise, I didn't reorder anything, just added std::allocator_traits<base>; and removed

        typedef typename base::reference reference;
        typedef typename base::const_reference const_reference;
    

    PastaPastaPasta commented at 4:23 PM on October 13, 2021:

    see https://github.com/bitcoin/bitcoin/pull/23181/commits/7c1548626bbd52bfc33fd1814ea2e1b3b28c5218

    Will squash all into one commit one we are happy with the diff

  10. in src/support/allocators/secure.h:20 in 154f1286ba outdated
      17 | @@ -18,14 +18,13 @@
      18 |  template <typename T>
      19 |  struct secure_allocator : public std::allocator<T> {
      20 |      // MSVC8 default copy constructor is broken
    


    laanwj commented at 2:07 PM on October 13, 2021:

    Do we still need a comment about MSVC8? (same below) According to wikipedia this is from 2008? Might as well clean these up here.


    PastaPastaPasta commented at 4:22 PM on October 13, 2021:

    see https://github.com/bitcoin/bitcoin/pull/23181/commits/23335238eb4c843f6c33f993817ef8264896e33b

    Will squash all into one commit one we are happy with the diff

  11. laanwj commented at 12:41 PM on October 15, 2021: member

    Code review ACK, would prefer squashing the commits

  12. 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
    ea4b61a157
  13. PastaPastaPasta force-pushed on Oct 20, 2021
  14. PastaPastaPasta commented at 10:37 PM on October 20, 2021: contributor

    squashed

  15. PastaPastaPasta requested review from laanwj on Oct 22, 2021
  16. PastaPastaPasta requested review from jonatack on Oct 22, 2021
  17. laanwj commented at 1:30 PM on October 22, 2021: member

    Re-ACK ea4b61a1570178ebe5851b5fb4065222e3926f7e

  18. laanwj merged this on Oct 22, 2021
  19. laanwj closed this on Oct 22, 2021

  20. sidhujag referenced this in commit fd13cd7f74 on Oct 22, 2021
  21. PastaPastaPasta deleted the branch on Oct 22, 2021
  22. PastaPastaPasta referenced this in commit b3dbb5e4b7 on Oct 22, 2021
  23. UdjinM6 referenced this in commit cd29362eea on Oct 23, 2021
  24. pravblockc referenced this in commit b533db8954 on Nov 18, 2021
  25. gades referenced this in commit 25fed21c43 on Apr 29, 2022
  26. DrahtBot locked this on Oct 30, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-15 00:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me