mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-11 08:20:18 -06:00
Mark operator bool explicit
This commit is contained in:
@@ -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(); }
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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_; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user