From patchwork Fri May 8 22:10:33 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 26704 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 50625BDCBD for ; Fri, 8 May 2026 22:10:37 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 6938C63025; Sat, 9 May 2026 00:10:36 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="hdC3yIQ0"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id EC1C862010 for ; Sat, 9 May 2026 00:10:34 +0200 (CEST) Received: from killaraus.ideasonboard.com (2001-14ba-70f3-e800--a06.rev.dnainternet.fi [IPv6:2001:14ba:70f3:e800::a06]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id AC9E84DC for ; Sat, 9 May 2026 00:10:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1778278229; bh=OAC4Dqs8KFNvSfXXWseX+R0xMY3RHvZrV+NSCRriBec=; h=From:To:Subject:Date:From; b=hdC3yIQ0cGfyDJjcBeZJQhsKcczTCLaWTUk0IX+EYnmP585rSieGVX+p75eUsC0bC Sfurwn92IsSAWgVxsPKNyt9mrQF7DVX+Zq7U+viCqwC+caZpGEIw4oN6/ust9hHjks /Yq/meqYiGukep3glnwDaFOmBlVVavkOdwsjwNAk= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Subject: [PATCH] libcamera: bound_method: Use std::apply Date: Sat, 9 May 2026 01:10:33 +0300 Message-ID: <20260508221033.2417134-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.53.0 MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Now that libcamera uses C++20, we can use std::apply to replace the custom implementation. Signed-off-by: Laurent Pinchart --- include/libcamera/base/bound_method.h | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) base-commit: 2ca75f012fa12621ed70e333e635d173e92593e5 diff --git a/include/libcamera/base/bound_method.h b/include/libcamera/base/bound_method.h index 91fe8b8cb969..ad5374f70b18 100644 --- a/include/libcamera/base/bound_method.h +++ b/include/libcamera/base/bound_method.h @@ -91,15 +91,14 @@ public: using PackType = BoundMethodPack; private: - template - void invokePack(BoundMethodPackBase *pack, std::index_sequence) + void invokePack(PackType *args) { - [[maybe_unused]] auto *args = static_cast(pack); - if constexpr (!std::is_void_v) - args->ret_ = invoke(std::get(args->args_)...); + args->ret_ = std::apply(&BoundMethodArgs::invoke, + std::tuple_cat(std::forward_as_tuple(this), args->args_)); else - invoke(std::get(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{}); + invokePack(static_cast(pack)); } virtual R activate(Args... args, bool deleteMethod = false) = 0;