summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2023-07-27 08:52:10 -0400
committerNat Goodspeed <nat@lindenlab.com>2023-07-27 08:52:10 -0400
commit35e8d44e17bb53b01ca8c73d3302d08220f5373c (patch)
tree6c71f2aa87832944ee0eee612b2d7710bd2fe3a4 /indra
parent861cf0a5d0590eac2ce6486d94ff3d121f8f775b (diff)
DRTVWR-587: Tweak LazyEventAPIBase::add() to mollify clang.
Both the previous version and this compile and run successfully with Xcode 14.3.1, but our older TeamCity compiler chokes -- so we must iterate remotely, sigh.
Diffstat (limited to 'indra')
-rw-r--r--indra/llcommon/lazyeventapi.h17
1 files changed, 7 insertions, 10 deletions
diff --git a/indra/llcommon/lazyeventapi.h b/indra/llcommon/lazyeventapi.h
index a815b119f0..e2dec8f35b 100644
--- a/indra/llcommon/lazyeventapi.h
+++ b/indra/llcommon/lazyeventapi.h
@@ -71,25 +71,22 @@ namespace LL
mOperations.push_back(std::make_pair(name, desc));
// Use connect_extended() so the lambda is passed its own
// connection.
+
// We can't bind an unexpanded parameter pack into a lambda --
- // shame really. Instead, capture it as a std::tuple and then, in
- // the lambda, use apply() to convert back to function args.
+ // shame really. Instead, capture all our args as a std::tuple and
+ // then, in the lambda, use apply() to pass to add_trampoline().
mParams.init.connect_extended(
- [name, desc, rest = std::make_tuple(std::forward<ARGS>(rest)...)]
+ [args = std::make_tuple(name, desc, std::forward<ARGS>(rest)...)]
(const boost::signals2::connection& conn, LLEventAPI* instance)
{
// we only need this connection once
conn.disconnect();
- // Our add() method distinguishes name and desc because we
- // capture them separately. But now, because apply()
- // expects a tuple specifying ALL the arguments, expand to
- // a tuple including add_trampoline() arguments: instance,
- // name, desc, rest.
+ // apply() expects a tuple specifying ALL the arguments,
+ // so prepend instance.
// apply() can't accept a template per se; it needs a
// particular specialization.
apply(&LazyEventAPIBase::add_trampoline<const std::string&, const std::string&, ARGS...>,
- std::tuple_cat(std::make_tuple(instance, name, desc),
- rest));
+ std::tuple_cat(std::make_tuple(instance), args));
});
}