Now that we can use std::variant from the vanilla standard library, drop the third-party boost variant dependency
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-
MarcoFalke commented at 5:32 PM on November 24, 2020: member
- MarcoFalke added the label Refactoring on Nov 24, 2020
- MarcoFalke force-pushed on Nov 24, 2020
-
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.
-
practicalswift commented at 8:02 PM on November 24, 2020: contributor
Concept ACK
- DrahtBot cross-referenced this on Nov 24, 2020 from issue BIP-322 support by kallewoof
- DrahtBot cross-referenced this on Nov 25, 2020 from issue fuzz: Add fuzzing harness for TorController by practicalswift
- DrahtBot cross-referenced this on Nov 25, 2020 from issue [WIP DONOTMERGE] Replace boost with C++17 (std::shared_mutex) by MarcoFalke
- 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
- DrahtBot cross-referenced this on Nov 25, 2020 from issue refactor: Extract RipeMd160 by Empact
-
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.
promag commented at 11:23 PM on November 25, 2020: memberConcept ACK.
MarcoFalke force-pushed on Nov 26, 2020RandyMcMillan commented at 3:47 PM on November 26, 2020: contributorConcept ACK :)
theStack commented at 11:24 PM on November 26, 2020: contributorConcept ACK 🚀
jonasschnelli commented at 10:46 AM on December 1, 2020: contributorConcept ACK
laanwj commented at 12:56 PM on December 3, 2020: memberConcept ACK
MarcoFalke force-pushed on Dec 21, 2020MarcoFalke cross-referenced this on Dec 21, 2020 from issue rpc: Replace boost::variant with std::variant for RPCArg.m_fallback by MarcoFalkeDrahtBot cross-referenced this on Dec 26, 2020 from issue [POC/DRAFT] - Finalize remove reqsigs deprecation from rpcs by mjdietzxDrahtBot cross-referenced this on Dec 29, 2020 from issue rpc: deprecate `addresses` and `reqSigs` from rpc outputs by mjdietzxin 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.
fjahr commented at 1:17 PM on January 1, 2021: contributorConcept ACK
Code looks good, I had started looking into similar changes before I found this.
MarcoFalke referenced this in commit bc8ada1c15 on Jan 4, 2021MarcoFalke force-pushed on Jan 4, 2021MarcoFalke force-pushed on Jan 4, 2021MarcoFalke force-pushed on Jan 4, 2021MarcoFalke force-pushed on Jan 4, 2021MarcoFalke commented at 3:00 PM on January 4, 2021: memberAddressed feedback by @fjahr
sidhujag referenced this in commit 2e6fb6f50e on Jan 4, 2021DrahtBot cross-referenced this on Jan 4, 2021 from issue rpc: Better error messages for invalid addresses by eilx2in 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
fjahr commented at 10:53 PM on January 4, 2021: contributorCode review ACK fa5ab4b7e4f609a1309503e3b3c5317ebf81a7e9
Thanks, the simplifications made this very straight forward to review IMO.
Replace boost::variant with std::variant faa8f68943MarcoFalke force-pushed on Jan 5, 2021fjahr commented at 11:18 PM on January 5, 2021: contributorCode review ACK faa8f68943615785a2855676cf96e0e96f3cc6bd
Only changes were sorting of includes and switching of
CTxDestinationfrom typedef to type alias.fanquake approvedfanquake commented at 4:05 AM on January 11, 2021: memberACK faa8f68943615785a2855676cf96e0e96f3cc6bd
fanquake merged this on Jan 11, 2021fanquake closed this on Jan 11, 2021MarcoFalke deleted the branch on Jan 11, 2021sidhujag referenced this in commit 3b0248f814 on Jan 11, 2021MarkLTZ referenced this in commit 6de0d15f61 on Feb 16, 2021jarolrod cross-referenced this on Jul 6, 2021 from issue Replace send-to-self with dual send+receive entries by luke-jrBushstar cross-referenced this on Sep 9, 2021 from issue C++17 and reduce Boost usage by Bushstargwillen cross-referenced this on Mar 21, 2022 from issue Bring Elements up to date with Bitcoin Core 22.0 by apoelstrabitcoin locked this on Aug 16, 2022
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