@@ -91,15 +91,14 @@ public:
using PackType = BoundMethodPack<R, Args...>;
private:
- template<std::size_t... I>
- void invokePack(BoundMethodPackBase *pack, std::index_sequence<I...>)
+ void invokePack(PackType *args)
{
- [[maybe_unused]] auto *args = static_cast<PackType *>(pack);
-
if constexpr (!std::is_void_v<R>)
- args->ret_ = invoke(std::get<I>(args->args_)...);
+ args->ret_ = std::apply(&BoundMethodArgs::invoke,
+ std::tuple_cat(std::forward_as_tuple(this), args->args_));
else
- invoke(std::get<I>(args->args_)...);
+ std::apply(&BoundMethodArgs::invoke,
+ std::tuple_cat(std::forward_as_tuple(this), args->args_));
}
public:
@@ -108,7 +107,7 @@ public:
void invokePack(BoundMethodPackBase *pack) override
{
- invokePack(pack, std::make_index_sequence<sizeof...(Args)>{});
+ invokePack(static_cast<PackType *>(pack));
}
virtual R activate(Args... args, bool deleteMethod = false) = 0;
Now that libcamera uses C++20, we can use std::apply to replace the custom implementation. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> --- include/libcamera/base/bound_method.h | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) base-commit: 2ca75f012fa12621ed70e333e635d173e92593e5