Patch Detail
Show a patch.
GET /api/patches/26709/?format=api
{ "id": 26709, "url": "https://patchwork.libcamera.org/api/patches/26709/?format=api", "web_url": "https://patchwork.libcamera.org/patch/26709/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20260511111121.3042550-1-laurent.pinchart@ideasonboard.com>", "date": "2026-05-11T11:11:21", "name": "[v2] libcamera: bound_method: Use std::apply", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "d310ab466703eae5ffe8c9393e299e38fc3e5c37", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/26709/mbox/", "series": [ { "id": 5931, "url": "https://patchwork.libcamera.org/api/series/5931/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5931", "date": "2026-05-11T11:11:21", "name": "[v2] libcamera: bound_method: Use std::apply", "version": 2, "mbox": "https://patchwork.libcamera.org/series/5931/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/26709/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/26709/checks/", "tags": {}, "headers": { "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>", "X-Original-To": "parsemail@patchwork.libcamera.org", "Delivered-To": "parsemail@patchwork.libcamera.org", "Received": [ "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id BD989BDCBD\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 11 May 2026 11:11:25 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CDF8C62E9D;\n\tMon, 11 May 2026 13:11:24 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D68B062DC4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 11 May 2026 13:11:22 +0200 (CEST)", "from killaraus.ideasonboard.com\n\t(2001-14ba-70f3-e800--a06.rev.dnainternet.fi\n\t[IPv6:2001:14ba:70f3:e800::a06])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id BD5EC244\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 11 May 2026 13:11:15 +0200 (CEST)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"sH/USSO1\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1778497875;\n\tbh=c+E9c5UOz6YzV1cP1avah08NEMzFiGCt4YxsERzzy2I=;\n\th=From:To:Subject:Date:From;\n\tb=sH/USSO1w8cJOoGr/21g9XgJEcrpLAAswKGruSRbODeWTdebo5wMh4+1vqAvBJ/34\n\t/cwXHKnl0QxbIVzR44ZrTR10tQ+oeZ2mu5hfQocjqFFH8h864shVBI1p+ocI2AyJ8M\n\t7FUVFXUmt6y7FAQsbDrH0siOdtGW/P8oljnh/9r4=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Subject": "[PATCH v2] libcamera: bound_method: Use std::apply", "Date": "Mon, 11 May 2026 14:11:21 +0300", "Message-ID": "<20260511111121.3042550-1-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.53.0", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "<libcamera-devel.lists.libcamera.org>", "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>", "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>", "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>", "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>", "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Now that libcamera uses C++17, we can use std::apply to replace the\ncustom implementation.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\nChanges since v1:\n\n- Drop private invokePack() overload\n- Use lambda function and std::move() to avoid copy\n---\n include/libcamera/base/bound_method.h | 22 ++++++++--------------\n 1 file changed, 8 insertions(+), 14 deletions(-)\n\n\nbase-commit: 500c2320619a47bd01d1ffe69ca4cc6eae6e00e8", "diff": "diff --git a/include/libcamera/base/bound_method.h b/include/libcamera/base/bound_method.h\nindex 9b42a8a1e8ca..f11159e8a0a4 100644\n--- a/include/libcamera/base/bound_method.h\n+++ b/include/libcamera/base/bound_method.h\n@@ -90,25 +90,19 @@ class BoundMethodArgs : public BoundMethodBase\n public:\n \tusing PackType = BoundMethodPack<R, Args...>;\n \n-private:\n-\ttemplate<std::size_t... I>\n-\tvoid invokePack(BoundMethodPackBase *pack, std::index_sequence<I...>)\n-\t{\n-\t\t[[maybe_unused]] auto *args = static_cast<PackType *>(pack);\n-\n-\t\tif constexpr (!std::is_void_v<R>)\n-\t\t\targs->ret_ = invoke(std::forward<Args>(std::get<I>(args->args_))...);\n-\t\telse\n-\t\t\tinvoke(std::forward<Args>(std::get<I>(args->args_))...);\n-\t}\n-\n-public:\n \tBoundMethodArgs(void *obj, Object *object, ConnectionType type)\n \t\t: BoundMethodBase(obj, object, type) {}\n \n \tvoid invokePack(BoundMethodPackBase *pack) override\n \t{\n-\t\tinvokePack(pack, std::make_index_sequence<sizeof...(Args)>{});\n+\t\tauto *argsPack = static_cast<PackType *>(pack);\n+\n+\t\tstd::apply([&](Args &&...args) {\n+\t\t\tif constexpr (!std::is_void_v<R>)\n+\t\t\t\targsPack->ret_ = invoke(std::forward<decltype(args)>(args)...);\n+\t\t\telse\n+\t\t\t\tinvoke(std::forward<decltype(args)>(args)...);\n+\t\t}, std::move(argsPack->args_));\n \t}\n \n \tvirtual R activate(Args... args, bool deleteMethod = false) = 0;\n", "prefixes": [ "v2" ] }