Merge #11351: Refactor: Modernize disallowed copy constructors/assignment

2a07f878a Refactor: Modernize disallowed copy constructors/assignment (Dan Raviv)

Pull request description:

  Use C++11's better capability of expressing an interface of a non-copyable class by publicly deleting its copy ctor and assignment operator instead of just declaring them private.

Tree-SHA512: 878f446be5a136bb2a90643aaeaca62948b575e6ef71ccc5b4b8f373e66f36ced00665128f36504e0ccfee639863d969329c4276154ef9f2a9de9137f0801e01
This commit is contained in:
Pieter Wuille
2017-09-21 22:33:06 -07:00
7 changed files with 30 additions and 34 deletions

View File

@@ -156,6 +156,9 @@ public:
explicit CDB(CWalletDBWrapper& dbw, const char* pszMode = "r+", bool fFlushOnCloseIn=true);
~CDB() { Close(); }
CDB(const CDB&) = delete;
CDB& operator=(const CDB&) = delete;
void Flush();
void Close();
static bool Recover(const std::string& filename, void *callbackDataIn, bool (*recoverKVcallback)(void* callbackData, CDataStream ssKey, CDataStream ssValue), std::string& out_backup_filename);
@@ -168,10 +171,6 @@ public:
/* verifies the database file */
static bool VerifyDatabaseFile(const std::string& walletFile, const fs::path& dataDir, std::string& warningStr, std::string& errorStr, CDBEnv::recoverFunc_type recoverFunc);
private:
CDB(const CDB&);
void operator=(const CDB&);
public:
template <typename K, typename T>
bool Read(const K& key, T& value)

View File

@@ -167,6 +167,8 @@ public:
m_dbw(dbw)
{
}
CWalletDB(const CWalletDB&) = delete;
CWalletDB& operator=(const CWalletDB&) = delete;
bool WriteName(const std::string& strAddress, const std::string& strName);
bool EraseName(const std::string& strAddress);
@@ -244,9 +246,6 @@ public:
private:
CDB batch;
CWalletDBWrapper& m_dbw;
CWalletDB(const CWalletDB&);
void operator=(const CWalletDB&);
};
//! Compacts BDB state so that wallet.dat is self-contained (if there are changes)