diff options
author | Abseil Team <absl-team@google.com> | 2022-10-11 10:27:17 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2022-10-11 10:28:00 -0700 |
commit | 73789eb0689071b0b02b00cb3daed9f224ff1a10 (patch) | |
tree | b6fec5c27f8d6044655b85b021d5702e5f3b73e8 /absl/functional/any_invocable.h | |
parent | 845610e80b66aa3d834f4d1b401133919bf7fadb (diff) | |
download | abseil-73789eb0689071b0b02b00cb3daed9f224ff1a10.tar.gz abseil-73789eb0689071b0b02b00cb3daed9f224ff1a10.tar.bz2 abseil-73789eb0689071b0b02b00cb3daed9f224ff1a10.zip |
Detects accidental multiple invocations of AnyInvocable<R(...)&&>::operator()&& by producing an error in debug mode, and clarifies that the behavior is undefined in the general case.
PiperOrigin-RevId: 480392976
Change-Id: I2d4c6f213fa7c8747f125c9735272a8e47b9214b
Diffstat (limited to 'absl/functional/any_invocable.h')
-rw-r--r-- | absl/functional/any_invocable.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/absl/functional/any_invocable.h b/absl/functional/any_invocable.h index 040418d4..3e783c87 100644 --- a/absl/functional/any_invocable.h +++ b/absl/functional/any_invocable.h @@ -148,6 +148,9 @@ ABSL_NAMESPACE_BEGIN // // rvalue-reference qualified. // std::move(continuation)(result_of_foo); // } +// +// Attempting to call `absl::AnyInvocable` multiple times in such a case +// results in undefined behavior. template <class Sig> class AnyInvocable : private internal_any_invocable::Impl<Sig> { private: |