diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2023-07-26 12:36:09 -0400 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2023-07-26 18:14:07 -0400 |
commit | 861cf0a5d0590eac2ce6486d94ff3d121f8f775b (patch) | |
tree | 36faa1965932c23bf9af2737a5d4c56fecf954d6 | |
parent | df880791b81c5d0ebe9b65011107e867ad042ac2 (diff) |
DRTVWR-587: Move constexpr arity into lambda that uses it.
VC doesn't recognize that a constexpr name doesn't need to be bound into a
lambda. However, since it's knowable at compile time, it can be deduced within
the innermost lambda.
(cherry picked from commit 37c3daff1a565eaafee691dfb57702b6b8f024d6)
-rw-r--r-- | indra/llcommon/lleventdispatcher.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/indra/llcommon/lleventdispatcher.h b/indra/llcommon/lleventdispatcher.h index 6c7338efb9..b4a610bf2d 100644 --- a/indra/llcommon/lleventdispatcher.h +++ b/indra/llcommon/lleventdispatcher.h @@ -724,10 +724,6 @@ template <typename Method, typename InstanceGetter> LLEventDispatcher::invoker_function LLEventDispatcher::make_invoker(Method f, const InstanceGetter& getter) { - // function_arity<member function> includes its implicit 'this' pointer - constexpr auto arity = LL::function_arity< - typename std::remove_reference<Method>::type>::value - 1; - return [f, getter](const LLSD& args) { // always_return<LLSD>() immediately calls the lambda we pass, and @@ -736,6 +732,10 @@ LLEventDispatcher::make_invoker(Method f, const InstanceGetter& getter) [f, getter, args] () { + // function_arity<member function> includes its implicit 'this' pointer + constexpr auto arity = LL::function_arity< + typename std::remove_reference<Method>::type>::value - 1; + // Use bind_front() to bind the method to (a pointer to) the object // returned by getter(). It's okay to capture and bind a pointer // because this bind_front() object will last only as long as this |