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