Make all operator bool const and nonexcept.
This commit is contained in:
parent
445cd4118d
commit
683627a350
@ -496,7 +496,7 @@ class SecretChatActor final : public NetQueryCallback {
|
||||
public:
|
||||
Change() : message_id() {
|
||||
}
|
||||
explicit operator bool() const {
|
||||
explicit operator bool() const noexcept {
|
||||
return !data.empty();
|
||||
}
|
||||
explicit Change(const StateT &state) {
|
||||
|
@ -145,7 +145,7 @@ FileNode *FileNodePtr::get_unsafe() const {
|
||||
return file_manager_->get_file_node_raw(file_id_);
|
||||
}
|
||||
|
||||
FileNodePtr::operator bool() const {
|
||||
FileNodePtr::operator bool() const noexcept {
|
||||
return file_manager_ != nullptr && get_unsafe() != nullptr;
|
||||
}
|
||||
|
||||
|
@ -208,7 +208,7 @@ class FileNodePtr {
|
||||
FileNode &operator*() const;
|
||||
FileNode *get() const;
|
||||
FullRemoteFileLocation *get_remote() const;
|
||||
explicit operator bool() const;
|
||||
explicit operator bool() const noexcept;
|
||||
|
||||
private:
|
||||
FileId file_id_;
|
||||
@ -229,7 +229,7 @@ class ConstFileNodePtr {
|
||||
return file_node_ptr_.operator*();
|
||||
}
|
||||
|
||||
explicit operator bool() const {
|
||||
explicit operator bool() const noexcept {
|
||||
return static_cast<bool>(file_node_ptr_);
|
||||
}
|
||||
const FullRemoteFileLocation *get_remote() const {
|
||||
|
@ -24,7 +24,7 @@ class NetQueryCounter {
|
||||
counter->fetch_add(1, std::memory_order_relaxed);
|
||||
}
|
||||
|
||||
explicit operator bool() const {
|
||||
explicit operator bool() const noexcept {
|
||||
return static_cast<bool>(ptr_);
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ class SslStream {
|
||||
size_t flow_read(MutableSlice slice);
|
||||
size_t flow_write(Slice slice);
|
||||
|
||||
explicit operator bool() const {
|
||||
explicit operator bool() const noexcept {
|
||||
return static_cast<bool>(impl_);
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ struct RawCancellationToken {
|
||||
|
||||
class CancellationToken {
|
||||
public:
|
||||
explicit operator bool() const {
|
||||
explicit operator bool() const noexcept {
|
||||
// empty CancellationToken is never canceled
|
||||
if (!token_) {
|
||||
return false;
|
||||
|
@ -36,7 +36,7 @@ namespace td {
|
||||
template <int shift>
|
||||
struct MaskIterator {
|
||||
uint64 mask;
|
||||
explicit operator bool() const {
|
||||
explicit operator bool() const noexcept {
|
||||
return mask != 0;
|
||||
}
|
||||
int pos() const {
|
||||
|
@ -158,7 +158,7 @@ class MpscLinkQueueUniquePtrNode {
|
||||
return MpscLinkQueueUniquePtrNode<Value>(unique_ptr<Value>(Value::from_mpsc_link_queue_node(node)));
|
||||
}
|
||||
|
||||
explicit operator bool() {
|
||||
explicit operator bool() const noexcept {
|
||||
return ptr_ != nullptr;
|
||||
}
|
||||
|
||||
|
@ -245,7 +245,7 @@ class Promise {
|
||||
Promise(F &&f) : promise_(detail::promise_interface_ptr<T>(std::forward<F>(f))) {
|
||||
}
|
||||
|
||||
explicit operator bool() {
|
||||
explicit operator bool() const noexcept {
|
||||
return static_cast<bool>(promise_);
|
||||
}
|
||||
|
||||
|
@ -123,10 +123,10 @@ class SharedPtr {
|
||||
other.raw_ = nullptr;
|
||||
return *this;
|
||||
}
|
||||
bool empty() const {
|
||||
bool empty() const noexcept {
|
||||
return raw_ == nullptr;
|
||||
}
|
||||
explicit operator bool() const {
|
||||
explicit operator bool() const noexcept {
|
||||
return !empty();
|
||||
}
|
||||
uint64 use_cnt() const {
|
||||
@ -255,7 +255,7 @@ class SharedObjectPool {
|
||||
Raw *get() const {
|
||||
return raw_;
|
||||
}
|
||||
explicit operator bool() const {
|
||||
explicit operator bool() noexcept {
|
||||
return raw_ != nullptr;
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ class Timestamp {
|
||||
return is_in_past(now_cached());
|
||||
}
|
||||
|
||||
explicit operator bool() const {
|
||||
explicit operator bool() const noexcept {
|
||||
return at_ > 0;
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ class optional {
|
||||
optional &operator=(optional &&other) = default;
|
||||
~optional() = default;
|
||||
|
||||
explicit operator bool() const {
|
||||
explicit operator bool() const noexcept {
|
||||
return impl_.is_ok();
|
||||
}
|
||||
T &value() {
|
||||
|
@ -156,7 +156,7 @@ NativeFd::~NativeFd() {
|
||||
close();
|
||||
}
|
||||
|
||||
NativeFd::operator bool() const {
|
||||
NativeFd::operator bool() const noexcept {
|
||||
return fd_ != empty_fd();
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ class NativeFd {
|
||||
NativeFd &operator=(NativeFd &&other) noexcept;
|
||||
~NativeFd();
|
||||
|
||||
explicit operator bool() const;
|
||||
explicit operator bool() const noexcept;
|
||||
|
||||
Fd fd() const;
|
||||
Socket socket() const;
|
||||
|
Loading…
Reference in New Issue
Block a user