mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 08:40:50 +00:00
Merge pull request #37388 from CurtizJ/explicit-bool-operator
Mark all `operator bool()` as explicit
This commit is contained in:
commit
4bfbb0b7ba
@ -219,7 +219,7 @@ protected:
|
||||
/// Get internal immutable ptr. Does not change internal use counter.
|
||||
immutable_ptr<T> detach() && { return std::move(value); }
|
||||
|
||||
operator bool() const { return value != nullptr; } /// NOLINT
|
||||
explicit operator bool() const { return value != nullptr; }
|
||||
bool operator! () const { return value == nullptr; }
|
||||
|
||||
bool operator== (const chameleon_ptr & rhs) const { return value == rhs.value; }
|
||||
|
@ -169,7 +169,7 @@ struct StringHashTableLookupResult
|
||||
auto & operator*() const { return *this; }
|
||||
auto * operator->() { return this; }
|
||||
auto * operator->() const { return this; }
|
||||
operator bool() const { return mapped_ptr; } /// NOLINT
|
||||
explicit operator bool() const { return mapped_ptr; }
|
||||
friend bool operator==(const StringHashTableLookupResult & a, const std::nullptr_t &) { return !a.mapped_ptr; }
|
||||
friend bool operator==(const std::nullptr_t &, const StringHashTableLookupResult & b) { return !b.mapped_ptr; }
|
||||
friend bool operator!=(const StringHashTableLookupResult & a, const std::nullptr_t &) { return a.mapped_ptr; }
|
||||
|
@ -161,7 +161,7 @@ public:
|
||||
task_info->deactivate();
|
||||
}
|
||||
|
||||
operator bool() const { return task_info != nullptr; } /// NOLINT
|
||||
explicit operator bool() const { return task_info != nullptr; }
|
||||
|
||||
BackgroundSchedulePoolTaskInfo * operator->() { return task_info.get(); }
|
||||
const BackgroundSchedulePoolTaskInfo * operator->() const { return task_info.get(); }
|
||||
|
@ -108,7 +108,7 @@ public:
|
||||
/// Approximate number of allocated bytes in memory - for profiling and limits.
|
||||
size_t allocatedBytes() const;
|
||||
|
||||
operator bool() const { return !!columns(); } /// NOLINT
|
||||
explicit operator bool() const { return !!columns(); }
|
||||
bool operator!() const { return !this->operator bool(); } /// NOLINT
|
||||
|
||||
/** Get a list of column names separated by commas. */
|
||||
|
@ -90,7 +90,7 @@ public:
|
||||
bool hasRows() const { return num_rows > 0; }
|
||||
bool hasColumns() const { return !columns.empty(); }
|
||||
bool empty() const { return !hasRows() && !hasColumns(); }
|
||||
operator bool() const { return !empty(); } /// NOLINT
|
||||
explicit operator bool() const { return !empty(); }
|
||||
|
||||
void addColumn(ColumnPtr column);
|
||||
void addColumn(size_t position, ColumnPtr column);
|
||||
|
@ -88,7 +88,7 @@ void ParallelParsingInputFormat::parserThreadFunction(ThreadGroupStatusPtr threa
|
||||
// We don't know how many blocks will be. So we have to read them all
|
||||
// until an empty block occurred.
|
||||
Chunk chunk;
|
||||
while (!parsing_finished && (chunk = parser.getChunk()) != Chunk())
|
||||
while (!parsing_finished && (chunk = parser.getChunk()))
|
||||
{
|
||||
/// Variable chunk is moved, but it is not really used in the next iteration.
|
||||
/// NOLINTNEXTLINE(bugprone-use-after-move, hicpp-invalid-access-moved)
|
||||
|
@ -1480,7 +1480,7 @@ bool TCPHandler::receiveUnexpectedData(bool throw_exception)
|
||||
maybe_compressed_in = in;
|
||||
|
||||
auto skip_block_in = std::make_shared<NativeReader>(*maybe_compressed_in, client_tcp_protocol_version);
|
||||
bool read_ok = skip_block_in->read();
|
||||
bool read_ok = !!skip_block_in->read();
|
||||
|
||||
if (!read_ok)
|
||||
state.read_all_data = true;
|
||||
|
@ -29,7 +29,7 @@ struct MergeTreeIndexFormat
|
||||
MergeTreeIndexVersion version;
|
||||
const char* extension;
|
||||
|
||||
operator bool() const { return version != 0; } /// NOLINT
|
||||
explicit operator bool() const { return version != 0; }
|
||||
};
|
||||
|
||||
/// Stores some info about a single block of data.
|
||||
|
@ -22,7 +22,7 @@ struct StoragesInfo
|
||||
bool need_inactive_parts = false;
|
||||
MergeTreeData * data = nullptr;
|
||||
|
||||
operator bool() const { return storage != nullptr; } /// NOLINT
|
||||
explicit operator bool() const { return storage != nullptr; }
|
||||
MergeTreeData::DataPartsVector
|
||||
getParts(MergeTreeData::DataPartStateVector & state, bool has_state_column, bool require_projection_parts = false) const;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user