HomePhabricator

[refactoring] eliminate Boost::Optional for std::optional

Description

[refactoring] eliminate Boost::Optional for std::optional

Summary:

find ./src -type f \( -iname \*.h -o -iname \*.cpp \) -exec sed -i 's/Optional</std::optional</g' {} \;
find ./src -type f \( -iname \*.h -o -iname \*.cpp \) -exec sed -i 's/nullopt/std::nullopt/g' {} \;
find ./src -type f \( -iname \*.h -o -iname \*.cpp \) -exec sed -i 's/#include <optional.h>//g' {} \;
rm ./src/optional.h

a few changes apart from the scripts above were necessary:

1- on psbt.cpp a use of Boost::Optional::get_ptr() (doesn't exist in std::optional) was replaced with a slightly more cumbersome construct to preserve behavior (either pass a pointer to the value if initialized or nullptr)

2- in both wallet/rpcwallet.cpp and wallet/wallet.cpp a funky conditional initialization via Boost::MakeOptional was used to workaround gcc bug #47679. I've removed that, thinking it unlikely that bug exists for std::optional

3- in bench/wallet_balance.cpp a call to Boost::Optional::get_value_or is replaced with std::optional::value_or


Depends on D8493

Test Plan:

ninja all check check-functional

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Subscribers: deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D8494

Details

Provenance
majcostaAuthored on Nov 21 2020, 12:58
majcostaPushed on Nov 23 2020, 17:43
Reviewer
Restricted Project
Differential Revision
D8494: [refactoring] eliminate Boost::Optional for std::optional
Parents
rABCf24e79e45b2a: tests: Add RPCOverloadWrapper which overloads some disabled RPCs
Branches
Unknown
Tags
Unknown