Reland "Mark all bool conversion operators as explicit"
This is a reland of 325789c4576b60147ee1ef225d438cbb740f65ff Original change's description: > Mark all bool conversion operators as explicit > > An explicit bool conversion operator will still be used implicitly > when an expression appears in "bool context", e.g., as the condition > in an if statement, or as argument to logical operators. The > `explicit` annotation prevents conversion in other contexts, e.g., > converting both a and b to bool in an expression like `a == b`. > > Bug: None > Change-Id: I79ef35b1ea831e6011ae472900375ae8a3e617ab > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/250664 > Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org> > Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> > Commit-Queue: Niels Moller <nisse@webrtc.org> > Cr-Commit-Position: refs/heads/main@{#35927} Bug: None Change-Id: Ie057dfc8c0b5c498e2c8daff7620172c89f0e011 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/251380 Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org> Commit-Queue: Niels Moller <nisse@webrtc.org> Cr-Commit-Position: refs/heads/main@{#35962}
This commit is contained in:

committed by
WebRTC LUCI CQ

parent
15ad4ed676
commit
b02220d1a0
@ -36,7 +36,9 @@ class RtcEventLogParseStatus {
|
||||
}
|
||||
|
||||
bool ok() const { return error_.empty(); }
|
||||
ABSL_DEPRECATED("Use ok() instead") operator bool() const { return ok(); }
|
||||
ABSL_DEPRECATED("Use ok() instead") explicit operator bool() const {
|
||||
return ok();
|
||||
}
|
||||
|
||||
std::string message() const { return error_; }
|
||||
|
||||
|
@ -225,7 +225,7 @@ std::vector<ProbeClusterConfig> ProbeController::OnMaxTotalAllocatedBitrate(
|
||||
probes.push_back(second_probe_rate.bps());
|
||||
}
|
||||
return InitiateProbing(at_time_ms, probes,
|
||||
config_.allocation_allow_further_probing);
|
||||
config_.allocation_allow_further_probing.Get());
|
||||
}
|
||||
max_total_allocated_bitrate_ = max_total_allocated_bitrate;
|
||||
return std::vector<ProbeClusterConfig>();
|
||||
|
@ -152,7 +152,7 @@ class ScopedBuf {
|
||||
}
|
||||
}
|
||||
|
||||
operator bool() { return map_ != MAP_FAILED; }
|
||||
explicit operator bool() { return map_ != MAP_FAILED; }
|
||||
|
||||
void initialize(uint8_t* map, int map_size, int fd) {
|
||||
map_ = map;
|
||||
|
@ -220,7 +220,7 @@ class FieldTrialFlag : public FieldTrialParameterInterface {
|
||||
explicit FieldTrialFlag(std::string key);
|
||||
FieldTrialFlag(std::string key, bool default_value);
|
||||
bool Get() const;
|
||||
operator bool() const;
|
||||
explicit operator bool() const;
|
||||
|
||||
protected:
|
||||
bool Parse(absl::optional<std::string> str_value) override;
|
||||
|
@ -16,7 +16,7 @@ namespace {
|
||||
struct TestType {
|
||||
TestType() : has_value(true) {}
|
||||
TestType(bool b) : has_value(b) {}
|
||||
operator bool() { return has_value; }
|
||||
explicit operator bool() { return has_value; }
|
||||
bool has_value;
|
||||
int retain_count = 0;
|
||||
};
|
||||
|
Reference in New Issue
Block a user