diff options
author | Abseil Team <absl-team@google.com> | 2023-04-24 08:04:04 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2023-04-24 08:04:41 -0700 |
commit | 8bd7178b14ea61972f8b04e9a9352bc4a4666cfb (patch) | |
tree | 3355edf637fd61458b2b4467e322b89a18769fa1 /absl/functional/internal/function_ref.h | |
parent | 43e07a0ee0ee1111186a69bf32f65a0a2a24e387 (diff) |
Adds template specialization for nullptr assertion of absl::AnyInvocable types.
PiperOrigin-RevId: 526644558
Change-Id: I050162c2c0d667c32f7e11f51201054cca52667d
Diffstat (limited to 'absl/functional/internal/function_ref.h')
-rw-r--r-- | absl/functional/internal/function_ref.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/absl/functional/internal/function_ref.h b/absl/functional/internal/function_ref.h index a1ddbb0c..1cd34a3c 100644 --- a/absl/functional/internal/function_ref.h +++ b/absl/functional/internal/function_ref.h @@ -20,6 +20,7 @@ #include <type_traits> #include "absl/base/internal/invoke.h" +#include "absl/functional/any_invocable.h" #include "absl/meta/type_traits.h" namespace absl { @@ -90,6 +91,12 @@ void AssertNonNull(const std::function<Sig>& f) { (void)f; } +template <typename Sig> +void AssertNonNull(const AnyInvocable<Sig>& f) { + assert(f != nullptr); + (void)f; +} + template <typename F> void AssertNonNull(const F&) {} |