Merge #13769: Mark single-argument constructors "explicit"

1ac3c983bf Mark single-argument constructors "explicit" (practicalswift)

Pull request description:

  Mark single-argument constructors `explicit`.

  Rationale:
  * Avoid unexpected implicit promotions.

  From the developer notes:

  > **By default, declare single-argument constructors explicit.**
  > Rationale: This is a precaution to avoid unintended conversions that might arise when single-argument constructors are used as implicit conversion functions.

Tree-SHA512: 7901ed5be808c9d0ecb5ca501e1bc0395987fe1b7941b8548cebac2ff08a14f7dab61fab374a69b9ba29a9295a04245c814325c7f95b97ae558af0780f111dfa
This commit is contained in:
MarcoFalke 2018-08-27 13:32:59 -04:00
commit dd34204611
No known key found for this signature in database
GPG key ID: D2EA4850E7528B25
8 changed files with 9 additions and 9 deletions

View file

@ -15,7 +15,7 @@ namespace {
class HandlerImpl : public Handler
{
public:
HandlerImpl(boost::signals2::connection connection) : m_connection(std::move(connection)) {}
explicit HandlerImpl(boost::signals2::connection connection) : m_connection(std::move(connection)) {}
void disconnect() override { m_connection.disconnect(); }

View file

@ -31,7 +31,7 @@ namespace {
class PendingWalletTxImpl : public PendingWalletTx
{
public:
PendingWalletTxImpl(CWallet& wallet) : m_wallet(wallet), m_key(&wallet) {}
explicit PendingWalletTxImpl(CWallet& wallet) : m_wallet(wallet), m_key(&wallet) {}
const CTransaction& get() override { return *m_tx; }
@ -117,7 +117,7 @@ static WalletTxOut MakeWalletTxOut(CWallet& wallet, const CWalletTx& wtx, int n,
class WalletImpl : public Wallet
{
public:
WalletImpl(const std::shared_ptr<CWallet>& wallet) : m_shared_wallet(wallet), m_wallet(*wallet.get()) {}
explicit WalletImpl(const std::shared_ptr<CWallet>& wallet) : m_shared_wallet(wallet), m_wallet(*wallet.get()) {}
bool encryptWallet(const SecureString& wallet_passphrase) override
{

View file

@ -24,7 +24,7 @@ private:
const CChainParams& m_params;
public:
DestinationEncoder(const CChainParams& params) : m_params(params) {}
explicit DestinationEncoder(const CChainParams& params) : m_params(params) {}
std::string operator()(const CKeyID& id) const
{

View file

@ -71,7 +71,7 @@ public:
QList<AddressTableEntry> cachedAddressTable;
AddressTableModel *parent;
AddressTablePriv(AddressTableModel *_parent):
explicit AddressTablePriv(AddressTableModel *_parent):
parent(_parent) {}
void refreshAddressTable(interfaces::Wallet& wallet)

View file

@ -82,7 +82,7 @@ class RPCExecutor : public QObject
{
Q_OBJECT
public:
RPCExecutor(interfaces::Node& node) : m_node(node) {}
explicit RPCExecutor(interfaces::Node& node) : m_node(node) {}
public Q_SLOTS:
void request(const QString &command, const QString &walletID);

View file

@ -60,7 +60,7 @@ struct TxLessThan
class TransactionTablePriv
{
public:
TransactionTablePriv(TransactionTableModel *_parent) :
explicit TransactionTablePriv(TransactionTableModel *_parent) :
parent(_parent)
{
}

View file

@ -29,7 +29,7 @@ BOOST_FIXTURE_TEST_SUITE(miner_tests, TestingSetup)
// BOOST_CHECK_EXCEPTION predicates to check the specific validation error
class HasReason {
public:
HasReason(const std::string& reason) : m_reason(reason) {}
explicit HasReason(const std::string& reason) : m_reason(reason) {}
bool operator() (const std::runtime_error& e) const {
return std::string(e.what()).find(m_reason) != std::string::npos;
};

View file

@ -23,7 +23,7 @@ BOOST_FIXTURE_TEST_SUITE(validation_block_tests, RegtestingSetup)
struct TestSubscriber : public CValidationInterface {
uint256 m_expected_tip;
TestSubscriber(uint256 tip) : m_expected_tip(tip) {}
explicit TestSubscriber(uint256 tip) : m_expected_tip(tip) {}
void UpdatedBlockTip(const CBlockIndex* pindexNew, const CBlockIndex* pindexFork, bool fInitialDownload) override
{