diff options
author | Regina Pfeifer <regina@mailbox.org> | 2018-11-19 22:35:09 (GMT) |
---|---|---|
committer | Regina Pfeifer <regina@mailbox.org> | 2018-11-19 22:35:09 (GMT) |
commit | a2648dda97454efdc8c785d83cf039f6d2383e9e (patch) | |
tree | aacfe1e67c59539984df7229c9d6f645792681b1 | |
parent | 1dc85a6652bc8255ff7a9ef39028a7df45e3007b (diff) | |
download | CMake-a2648dda97454efdc8c785d83cf039f6d2383e9e.zip CMake-a2648dda97454efdc8c785d83cf039f6d2383e9e.tar.gz CMake-a2648dda97454efdc8c785d83cf039f6d2383e9e.tar.bz2 |
Mark operator bool explicit
-rw-r--r-- | Source/cmArchiveWrite.h | 8 | ||||
-rw-r--r-- | Source/cmCTest.h | 2 | ||||
-rw-r--r-- | Source/cmELF.h | 2 | ||||
-rw-r--r-- | Source/cmMachO.h | 2 | ||||
-rw-r--r-- | Source/cmQtAutoGenInitializer.h | 2 | ||||
-rw-r--r-- | Source/cmSystemTools.cxx | 5 |
6 files changed, 9 insertions, 12 deletions
diff --git a/Source/cmArchiveWrite.h b/Source/cmArchiveWrite.h index 6c678ac..6ecdd63 100644 --- a/Source/cmArchiveWrite.h +++ b/Source/cmArchiveWrite.h @@ -40,9 +40,6 @@ private: */ class cmArchiveWrite { - typedef void (cmArchiveWrite::*safe_bool)(); - void safe_bool_true() {} - public: /** Compression type. */ enum Compress @@ -73,10 +70,7 @@ public: bool recursive = true); /** Returns true if there has been no error. */ - operator safe_bool() const - { - return this->Okay() ? &cmArchiveWrite::safe_bool_true : nullptr; - } + explicit operator bool() const { return this->Okay(); } /** Returns true if there has been an error. */ bool operator!() const { return !this->Okay(); } diff --git a/Source/cmCTest.h b/Source/cmCTest.h index 427049d..9139e42 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -66,7 +66,7 @@ public: const std::string& GetName() const { return this->Name; } void Enable() { this->Enabled = true; } - operator bool() const { return this->Enabled; } + explicit operator bool() const { return this->Enabled; } std::vector<std::string> SubmitFiles; diff --git a/Source/cmELF.h b/Source/cmELF.h index 9172f38..c8a91e4 100644 --- a/Source/cmELF.h +++ b/Source/cmELF.h @@ -32,7 +32,7 @@ public: std::string const& GetErrorMessage() const { return this->ErrorMessage; } /** Boolean conversion. True if the ELF file is valid. */ - operator bool() const { return this->Valid(); } + explicit operator bool() const { return this->Valid(); } /** Enumeration of ELF file types. */ enum FileType diff --git a/Source/cmMachO.h b/Source/cmMachO.h index 5886d76..5482465 100644 --- a/Source/cmMachO.h +++ b/Source/cmMachO.h @@ -30,7 +30,7 @@ public: std::string const& GetErrorMessage() const; /** Boolean conversion. True if the Mach-O file is valid. */ - operator bool() const { return this->Valid(); } + explicit operator bool() const { return this->Valid(); } /** Get Install name from binary **/ bool GetInstallName(std::string& install_name); diff --git a/Source/cmQtAutoGenInitializer.h b/Source/cmQtAutoGenInitializer.h index 903ec85..d817848 100644 --- a/Source/cmQtAutoGenInitializer.h +++ b/Source/cmQtAutoGenInitializer.h @@ -54,7 +54,7 @@ public: InfoWriter(std::string const& filename); /// @return True if the file is open - operator bool() const { return static_cast<bool>(Ofs_); } + explicit operator bool() const { return static_cast<bool>(Ofs_); } void Write(const char* text) { Ofs_ << text; } void Write(const char* key, std::string const& value); diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 9866d13..28aa57c 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -137,7 +137,10 @@ public: CloseHandle(this->handle_); } } - operator bool() const { return this->handle_ != INVALID_HANDLE_VALUE; } + explicit operator bool() const + { + return this->handle_ != INVALID_HANDLE_VALUE; + } bool operator!() const { return this->handle_ == INVALID_HANDLE_VALUE; } operator HANDLE() const { return this->handle_; } |