refactor: simplify Invoker::IsOK() (#45818)

* refactor: simplify Invoker::IsOK()

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* refactor: might as well make it [[nodiscard]] as well

Co-authored-by: Charles Kerr <charles@charleskerr.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
This commit is contained in:
trop[bot] 2025-02-27 00:46:32 -06:00 committed by GitHub
parent 8a200e0427
commit 4417f74a5b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -262,7 +262,9 @@ class Invoker<std::index_sequence<indices...>, ArgTypes...>
: ArgumentHolder<indices, ArgTypes>(args, invoker_options)...,
args_(args) {}
bool IsOK() { return And(ArgumentHolder<indices, ArgTypes>::ok...); }
[[nodiscard]] bool IsOK() const {
return (... && ArgumentHolder<indices, ArgTypes>::ok);
}
template <typename ReturnType>
void DispatchToCallback(
@ -285,12 +287,6 @@ class Invoker<std::index_sequence<indices...>, ArgTypes...>
}
private:
static bool And() { return true; }
template <typename... T>
static bool And(bool arg1, T... args) {
return arg1 && And(args...);
}
raw_ptr<gin::Arguments> args_;
};