diff options
Diffstat (limited to 'absl/functional/any_invocable.h')
-rw-r--r-- | absl/functional/any_invocable.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/absl/functional/any_invocable.h b/absl/functional/any_invocable.h index 788bc1af..68d88253 100644 --- a/absl/functional/any_invocable.h +++ b/absl/functional/any_invocable.h @@ -269,6 +269,14 @@ class AnyInvocable : private internal_any_invocable::Impl<Sig> { // absl::AnyInvocable::operator bool() // // Returns `true` if `*this` is not empty. + // + // WARNING: An `AnyInvocable` that wraps an empty `std::function` is not + // itself empty. This behavior is consistent with the standard equivalent + // `std::move_only_function`. + // + // In other words: + // std::function<void()> f; // empty + // absl::AnyInvocable<void()> a = std::move(f); // not empty explicit operator bool() const noexcept { return this->HasValue(); } // Invokes the target object of `*this`. `*this` must not be empty. |