diff options
author | Abseil Team <absl-team@google.com> | 2023-09-15 08:14:33 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2023-09-15 08:15:17 -0700 |
commit | e68f1412e2cebdd5af106721007335ca45d51f83 (patch) | |
tree | ad5dc9666ec23e9ef0e68f21817829c2b160b0e2 /absl/functional/function_ref.h | |
parent | 9a592abd7c7508386666bdbcd00d8bc030bc966e (diff) | |
download | abseil-e68f1412e2cebdd5af106721007335ca45d51f83.tar.gz abseil-e68f1412e2cebdd5af106721007335ca45d51f83.tar.bz2 abseil-e68f1412e2cebdd5af106721007335ca45d51f83.zip |
Allow const qualified FunctionRef instances. This allows the signature to be compatible with AnyInvokable for const uses.
PiperOrigin-RevId: 565682320
Change-Id: I924dadf110481e572bdb8af0111fa62d6f553d90
Diffstat (limited to 'absl/functional/function_ref.h')
-rw-r--r-- | absl/functional/function_ref.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/absl/functional/function_ref.h b/absl/functional/function_ref.h index 2b9139d3..96cece55 100644 --- a/absl/functional/function_ref.h +++ b/absl/functional/function_ref.h @@ -137,6 +137,14 @@ class FunctionRef<R(Args...)> { absl::functional_internal::Invoker<R, Args...> invoker_; }; +// Allow const qualified function signatures. Since FunctionRef requires +// constness anyway we can just make this a no-op. +template <typename R, typename... Args> +class FunctionRef<R(Args...) const> : public FunctionRef<R(Args...)> { + public: + using FunctionRef<R(Args...)>::FunctionRef; +}; + ABSL_NAMESPACE_END } // namespace absl |