From 4417f74a5b8c1e5a1d51d26a1c5c0bd0a898adf5 Mon Sep 17 00:00:00 2001 From: "trop[bot]" <37223003+trop[bot]@users.noreply.github.com> Date: Thu, 27 Feb 2025 00:46:32 -0600 Subject: [PATCH] refactor: simplify Invoker::IsOK() (#45818) * refactor: simplify Invoker::IsOK() Co-authored-by: Charles Kerr * refactor: might as well make it [[nodiscard]] as well Co-authored-by: Charles Kerr --------- Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Charles Kerr --- shell/common/gin_helper/function_template.h | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/shell/common/gin_helper/function_template.h b/shell/common/gin_helper/function_template.h index 5633184bec60..2889d17beaea 100644 --- a/shell/common/gin_helper/function_template.h +++ b/shell/common/gin_helper/function_template.h @@ -262,7 +262,9 @@ class Invoker, ArgTypes...> : ArgumentHolder(args, invoker_options)..., args_(args) {} - bool IsOK() { return And(ArgumentHolder::ok...); } + [[nodiscard]] bool IsOK() const { + return (... && ArgumentHolder::ok); + } template void DispatchToCallback( @@ -285,12 +287,6 @@ class Invoker, ArgTypes...> } private: - static bool And() { return true; } - template - static bool And(bool arg1, T... args) { - return arg1 && And(args...); - } - raw_ptr args_; };