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)
meow-7.2.2
Nat Goodspeed 2023-07-26 12:36:09 -04:00
parent df880791b8
commit 861cf0a5d0
1 changed files with 4 additions and 4 deletions

View File

@ -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