Commit 9134967d authored by Abseil Team's avatar Abseil Team Committed by rogeeff
Browse files

Export of internal Abseil changes

--
2aa219620f39aa490fa989f5d92e1bd3e52a46c5 by Abseil Team <absl-team@google.com>:

Add lifetime annotations to FunctionRef.

PiperOrigin-RevId: 392131866
GitOrigin-RevId: 2aa219620f39aa490fa989f5d92e1bd3e52a46c5
Change-Id: I295b808986857e46a565e047db25a951dd7ce0e3
parent f39e6ad4
......@@ -60,6 +60,7 @@ cc_library(
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
"//absl/base:base_internal",
"//absl/base:core_headers",
"//absl/meta:type_traits",
],
)
......
......@@ -53,6 +53,7 @@ absl_cc_library(
${ABSL_DEFAULT_COPTS}
DEPS
absl::base_internal
absl::core_headers
absl::meta
PUBLIC
)
......
......@@ -50,6 +50,7 @@
#include <functional>
#include <type_traits>
#include "absl/base/attributes.h"
#include "absl/functional/internal/function_ref.h"
#include "absl/meta/type_traits.h"
......@@ -98,7 +99,8 @@ class FunctionRef<R(Args...)> {
public:
// Constructs a FunctionRef from any invokable type.
template <typename F, typename = EnableIfCompatible<const F&>>
FunctionRef(const F& f) // NOLINT(runtime/explicit)
// NOLINTNEXTLINE(runtime/explicit)
FunctionRef(const F& f ABSL_ATTRIBUTE_LIFETIME_BOUND)
: invoker_(&absl::functional_internal::InvokeObject<F, R, Args...>) {
absl::functional_internal::AssertNonNull(f);
ptr_.obj = &f;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment