From 861cf0a5d0590eac2ce6486d94ff3d121f8f775b Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Wed, 26 Jul 2023 12:36:09 -0400 Subject: 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) --- indra/llcommon/lleventdispatcher.h | 8 ++++---- 1 file 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 LLEventDispatcher::invoker_function LLEventDispatcher::make_invoker(Method f, const InstanceGetter& getter) { - // function_arity includes its implicit 'this' pointer - constexpr auto arity = LL::function_arity< - typename std::remove_reference::type>::value - 1; - return [f, getter](const LLSD& args) { // always_return() immediately calls the lambda we pass, and @@ -736,6 +732,10 @@ LLEventDispatcher::make_invoker(Method f, const InstanceGetter& getter) [f, getter, args] () { + // function_arity includes its implicit 'this' pointer + constexpr auto arity = LL::function_arity< + typename std::remove_reference::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 -- cgit v1.2.3