diff options
author | Dan Raviv <dan@soundradix.com> | 2017-09-16 13:06:05 +0300 |
---|---|---|
committer | Dan Raviv <dan@soundradix.com> | 2017-09-16 13:06:05 +0300 |
commit | 2a07f878a80003f2142d5052d015a9ac81a3a6bc (patch) | |
tree | 43e85852061f076a5a247cbb2eea8a8c59c73ce8 /src/streams.h | |
parent | e278f86c536921032e8288625dc5f3af610f2ec8 (diff) |
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.
Diffstat (limited to 'src/streams.h')
-rw-r--r-- | src/streams.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/streams.h b/src/streams.h index 159847279d..9a3badea57 100644 --- a/src/streams.h +++ b/src/streams.h @@ -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; } |