about summary refs log tree commit diff
path: root/absl/base/internal/exception_safety_testing.h
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2018-03-15T20·48-0700
committerAlex Strelnikov <strel@google.com>2018-03-16T14·00-0400
commiteed36bfba04dbe8a08ec72e631c3b337e4f2db11 (patch)
treeb67e166f799d78acf59dbf54ced6acdde7687bc7 /absl/base/internal/exception_safety_testing.h
parent2661ed4998e8c5e9fa0a7f58b2d32eeab6544a70 (diff)
Changes imported from Abseil "staging" branch:
  - 95e20a66bfa6104937ec92722b04a9c0ca0443dc Make ThrowingBool convertible to bool. by Xiaoyi Zhang <zhangxy@google.com>

GitOrigin-RevId: 95e20a66bfa6104937ec92722b04a9c0ca0443dc
Change-Id: I7a1dcb53b0764b24482ee1886276b267c8cb83c2
Diffstat (limited to 'absl/base/internal/exception_safety_testing.h')
-rw-r--r--absl/base/internal/exception_safety_testing.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/absl/base/internal/exception_safety_testing.h b/absl/base/internal/exception_safety_testing.h
index 8eac226488..adee848b2e 100644
--- a/absl/base/internal/exception_safety_testing.h
+++ b/absl/base/internal/exception_safety_testing.h
@@ -203,12 +203,12 @@ extern exceptions_internal::NoThrowTag no_throw_ctor;
 inline void SetCountdown() { exceptions_internal::countdown = 0; }
 inline void UnsetCountdown() { exceptions_internal::countdown = -1; }
 
-// A test class which is contextually convertible to bool.  The conversion can
-// be instrumented to throw at a controlled time.
+// A test class which is convertible to bool.  The conversion can be
+// instrumented to throw at a controlled time.
 class ThrowingBool {
  public:
   ThrowingBool(bool b) noexcept : b_(b) {}  // NOLINT(runtime/explicit)
-  explicit operator bool() const {
+  operator bool() const {  // NOLINT(runtime/explicit)
     exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION);
     return b_;
   }
@@ -355,6 +355,8 @@ class ThrowingValue : private exceptions_internal::TrackedObject {
   }
 
   // Comparison Operators
+  // NOTE: We use `ThrowingBool` instead of `bool` because most STL
+  // types/containers requires T to be convertible to bool.
   friend ThrowingBool operator==(const ThrowingValue& a,
                                  const ThrowingValue& b) {
     exceptions_internal::MaybeThrow(ABSL_PRETTY_FUNCTION);