From 8bd7178b14ea61972f8b04e9a9352bc4a4666cfb Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Mon, 24 Apr 2023 08:04:04 -0700 Subject: Adds template specialization for nullptr assertion of absl::AnyInvocable types. PiperOrigin-RevId: 526644558 Change-Id: I050162c2c0d667c32f7e11f51201054cca52667d --- absl/functional/internal/function_ref.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'absl/functional/internal/function_ref.h') 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 #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& f) { (void)f; } +template +void AssertNonNull(const AnyInvocable& f) { + assert(f != nullptr); + (void)f; +} + template void AssertNonNull(const F&) {} -- cgit v1.2.3