mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-10-11 03:53:22 +02:00
Refactor: Modernize disallowed copy constructors/assignment
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.
This commit is contained in:
@@ -455,10 +455,6 @@ public:
|
||||
class CAutoFile
|
||||
{
|
||||
private:
|
||||
// Disallow copies
|
||||
CAutoFile(const CAutoFile&);
|
||||
CAutoFile& operator=(const CAutoFile&);
|
||||
|
||||
const int nType;
|
||||
const int nVersion;
|
||||
|
||||
@@ -475,6 +471,10 @@ public:
|
||||
fclose();
|
||||
}
|
||||
|
||||
// Disallow copies
|
||||
CAutoFile(const CAutoFile&) = delete;
|
||||
CAutoFile& operator=(const CAutoFile&) = delete;
|
||||
|
||||
void fclose()
|
||||
{
|
||||
if (file) {
|
||||
@@ -564,10 +564,6 @@ public:
|
||||
class CBufferedFile
|
||||
{
|
||||
private:
|
||||
// Disallow copies
|
||||
CBufferedFile(const CBufferedFile&);
|
||||
CBufferedFile& operator=(const CBufferedFile&);
|
||||
|
||||
const int nType;
|
||||
const int nVersion;
|
||||
|
||||
@@ -609,6 +605,10 @@ public:
|
||||
fclose();
|
||||
}
|
||||
|
||||
// Disallow copies
|
||||
CBufferedFile(const CBufferedFile&) = delete;
|
||||
CBufferedFile& operator=(const CBufferedFile&) = delete;
|
||||
|
||||
int GetVersion() const { return nVersion; }
|
||||
int GetType() const { return nType; }
|
||||
|
||||
|
Reference in New Issue
Block a user