Replace boost::variant with std::variant #20480

pull MarcoFalke wants to merge 1 commits into bitcoin:master from MarcoFalke:2011-noBoostVariant changing 16 files +56 −66
  1. MarcoFalke commented at 5:32 PM on November 24, 2020: member

    Now that we can use std::variant from the vanilla standard library, drop the third-party boost variant dependency

  2. MarcoFalke added the label Refactoring on Nov 24, 2020
  3. MarcoFalke force-pushed on Nov 24, 2020
  4. DrahtBot commented at 7:44 PM on November 24, 2020: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #20832 (rpc: Better error messages for invalid addresses by eilx2)
    • #18194 (Bugfix: GUI: Remove broken ability to edit the address field in the sending address book by luke-jr)
    • #15294 ([moveonly] wallet: Extract RipeMd160 by Empact)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  5. practicalswift commented at 8:02 PM on November 24, 2020: contributor

    Concept ACK

  6. DrahtBot cross-referenced this on Nov 24, 2020 from issue BIP-322 support by kallewoof
  7. DrahtBot cross-referenced this on Nov 25, 2020 from issue fuzz: Add fuzzing harness for TorController by practicalswift
  8. DrahtBot cross-referenced this on Nov 25, 2020 from issue [WIP DONOTMERGE] Replace boost with C++17 (std::shared_mutex) by MarcoFalke
  9. DrahtBot cross-referenced this on Nov 25, 2020 from issue Bugfix: GUI: Remove broken ability to edit the address field in the sending address book by luke-jr
  10. DrahtBot cross-referenced this on Nov 25, 2020 from issue refactor: Extract RipeMd160 by Empact
  11. in src/rpc/util.cpp:212 in faccd6d836 outdated
     209 | @@ -209,65 +210,52 @@ CTxDestination AddAndGetMultisigDestination(const int required, const std::vecto
     210 |      return dest;
     211 |  }
     212 |  
     213 | -class DescribeAddressVisitor : public boost::static_visitor<UniValue>
    


    promag commented at 11:23 PM on November 25, 2020:

    Have you considered the "overload" approach from https://en.cppreference.com/w/cpp/utility/variant/visit (looks like it may be included in c++20, https://wg21.link/P0051)?


    MarcoFalke commented at 8:33 AM on November 26, 2020:

    That'd be dangerous because it allows for implicit conversions and non-exhaustive visitors. Bugs like #17924 would be harder to find if the overload approach was used.


    promag commented at 9:08 AM on November 26, 2020:

    Understood, thanks for the explanation.

  12. promag commented at 11:23 PM on November 25, 2020: member

    Concept ACK.

  13. MarcoFalke force-pushed on Nov 26, 2020
  14. RandyMcMillan commented at 3:47 PM on November 26, 2020: contributor

    Concept ACK :)

  15. theStack commented at 11:24 PM on November 26, 2020: contributor

    Concept ACK 🚀

  16. jonasschnelli commented at 10:46 AM on December 1, 2020: contributor

    Concept ACK

  17. laanwj commented at 12:56 PM on December 3, 2020: member

    Concept ACK

  18. MarcoFalke force-pushed on Dec 21, 2020
  19. MarcoFalke cross-referenced this on Dec 21, 2020 from issue rpc: Replace boost::variant with std::variant for RPCArg.m_fallback by MarcoFalke
  20. DrahtBot cross-referenced this on Dec 26, 2020 from issue [POC/DRAFT] - Finalize remove reqsigs deprecation from rpcs by mjdietzx
  21. DrahtBot cross-referenced this on Dec 29, 2020 from issue rpc: deprecate `addresses` and `reqSigs` from rpc outputs by mjdietzx
  22. in src/rpc/util.cpp:213 in fa1b3b6419 outdated
     209 | @@ -209,65 +210,52 @@ CTxDestination AddAndGetMultisigDestination(const int required, const std::vecto
     210 |      return dest;
     211 |  }
     212 |  
     213 | -class DescribeAddressVisitor : public boost::static_visitor<UniValue>
     214 | -{
     215 | -public:
     216 | -    explicit DescribeAddressVisitor() {}
     217 | +constexpr auto DescribeAddressVisitor = [](const auto& dest) -> UniValue {
    


    fjahr commented at 1:15 PM on January 1, 2021:

    Could you comment on why you chose to change the approach here but not on DescribeWalletAddressVisitor?


    MarcoFalke commented at 11:34 AM on January 4, 2021:

    No reason. Simplfied diff by using the same approach everywhere.

  23. fjahr commented at 1:17 PM on January 1, 2021: contributor

    Concept ACK

    Code looks good, I had started looking into similar changes before I found this.

  24. MarcoFalke referenced this in commit bc8ada1c15 on Jan 4, 2021
  25. MarcoFalke force-pushed on Jan 4, 2021
  26. MarcoFalke force-pushed on Jan 4, 2021
  27. MarcoFalke force-pushed on Jan 4, 2021
  28. MarcoFalke force-pushed on Jan 4, 2021
  29. MarcoFalke commented at 3:00 PM on January 4, 2021: member

    Addressed feedback by @fjahr

  30. sidhujag referenced this in commit 2e6fb6f50e on Jan 4, 2021
  31. DrahtBot cross-referenced this on Jan 4, 2021 from issue rpc: Better error messages for invalid addresses by eilx2
  32. in src/script/standard.h:12 in fa5ab4b7e4 outdated
       8 | @@ -9,7 +9,7 @@
       9 |  #include <script/interpreter.h>
      10 |  #include <uint256.h>
      11 |  
      12 | -#include <boost/variant.hpp>
      13 | +#include <variant>
    


    fjahr commented at 10:51 PM on January 4, 2021:

    nit: could probably be sorted below string


    MarcoFalke commented at 9:17 AM on January 5, 2021:

    Thanks, sorted includes

  33. fjahr commented at 10:53 PM on January 4, 2021: contributor

    Code review ACK fa5ab4b7e4f609a1309503e3b3c5317ebf81a7e9

    Thanks, the simplifications made this very straight forward to review IMO.

  34. Replace boost::variant with std::variant faa8f68943
  35. MarcoFalke force-pushed on Jan 5, 2021
  36. fjahr commented at 11:18 PM on January 5, 2021: contributor

    Code review ACK faa8f68943615785a2855676cf96e0e96f3cc6bd

    Only changes were sorting of includes and switching of CTxDestination from typedef to type alias.

  37. fanquake approved
  38. fanquake commented at 4:05 AM on January 11, 2021: member

    ACK faa8f68943615785a2855676cf96e0e96f3cc6bd

  39. fanquake merged this on Jan 11, 2021
  40. fanquake closed this on Jan 11, 2021

  41. MarcoFalke deleted the branch on Jan 11, 2021
  42. sidhujag referenced this in commit 3b0248f814 on Jan 11, 2021
  43. MarkLTZ referenced this in commit 6de0d15f61 on Feb 16, 2021
  44. jarolrod cross-referenced this on Jul 6, 2021 from issue Replace send-to-self with dual send+receive entries by luke-jr
  45. Bushstar cross-referenced this on Sep 9, 2021 from issue C++17 and reduce Boost usage by Bushstar
  46. gwillen cross-referenced this on Mar 21, 2022 from issue Bring Elements up to date with Bitcoin Core 22.0 by apoelstra
  47. bitcoin locked this on Aug 16, 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-05-20 06:54 UTC