summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-11-28 14:05:43 (GMT)
committerKitware Robot <kwrobot@kitware.com>2018-11-28 14:06:00 (GMT)
commitb134e89430404b7ad211ccd7b072c28410fae230 (patch)
tree8ffa0abf9eed94b8163e73e6732fb435ea097b45 /Source
parent5daf7d92f8971f13fb2f6fac117f44f355ec504a (diff)
parenta2648dda97454efdc8c785d83cf039f6d2383e9e (diff)
downloadCMake-b134e89430404b7ad211ccd7b072c28410fae230.zip
CMake-b134e89430404b7ad211ccd7b072c28410fae230.tar.gz
CMake-b134e89430404b7ad211ccd7b072c28410fae230.tar.bz2
Merge topic 'explicit-operator-bool'
a2648dda97 Mark operator bool explicit Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !2649
Diffstat (limited to 'Source')
-rw-r--r--Source/cmArchiveWrite.h8
-rw-r--r--Source/cmCTest.h2
-rw-r--r--Source/cmELF.h2
-rw-r--r--Source/cmMachO.h2
-rw-r--r--Source/cmQtAutoGenInitializer.h2
-rw-r--r--Source/cmSystemTools.cxx5
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_; }