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.
meow-7.2.2
Nat Goodspeed 2023-07-27 08:52:10 -04:00
parent 861cf0a5d0
commit 35e8d44e17
1 changed files with 7 additions and 10 deletions

View File

@ -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));
});
}