Show a patch.

GET /api/1.1/patches/22906/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 22906,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/22906/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/22906/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/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": "<20250303151438.732916-1-barnabas.pocze@ideasonboard.com>",
    "date": "2025-03-03T15:14:38",
    "name": "[v1] libcamera: base: bound_method: Forward arguments when possible",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "7dda5adfab5a542c1efbf469587b2d3e4305de9d",
    "submitter": {
        "id": 216,
        "url": "https://patchwork.libcamera.org/api/1.1/people/216/?format=api",
        "name": "Barnabás Pőcze",
        "email": "barnabas.pocze@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/22906/mbox/",
    "series": [
        {
            "id": 5034,
            "url": "https://patchwork.libcamera.org/api/1.1/series/5034/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5034",
            "date": "2025-03-03T15:14:38",
            "name": "[v1] libcamera: base: bound_method: Forward arguments when possible",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/5034/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/22906/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/22906/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 AD924C3257\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  3 Mar 2025 15:14:43 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B4FAC687EB;\n\tMon,  3 Mar 2025 16:14:42 +0100 (CET)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1084168772\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  3 Mar 2025 16:14:41 +0100 (CET)",
            "from pb-laptop.local (185.221.143.4.nat.pool.zt.hu [185.221.143.4])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 879C22D5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  3 Mar 2025 16:13:09 +0100 (CET)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"jBkkrZgR\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1741014789;\n\tbh=0qFqm/v5COfqSPQ/zKRXVQQzpgwyWs9uCV4ClsTUuU8=;\n\th=From:To:Subject:Date:From;\n\tb=jBkkrZgRawJOuqbEN1fv4JhNOgovcQBaw4z+v4P9ELLNrYDGZdbBqwqN2wt8mn/aF\n\tpJ0mQUlKPmFNZTX2bjz2v6Rw9JVhyViU16bz+gB7lA3TOGuo4PAr34z+HPDrvQSV23\n\tYEi7i9M1zIzZ0lnlCzqCS0wrwxYjvwOhRazh+jRA=",
        "From": "=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Subject": "[PATCH v1] libcamera: base: bound_method: Forward arguments when\n\tpossible",
        "Date": "Mon,  3 Mar 2025 16:14:38 +0100",
        "Message-ID": "<20250303151438.732916-1-barnabas.pocze@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.48.1",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "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": "Use `std::{forward,move}` to forward the arguments, this enables the\nuse of move constructors, likely leading to less code and better runtime.\nFor example, move constructing a libstdc++ `std::shared_ptr` is noticeably\nless code than copy constructing one.\n\nSigned-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n---\n include/libcamera/base/bound_method.h | 26 ++++++++++++++------------\n 1 file changed, 14 insertions(+), 12 deletions(-)",
    "diff": "diff --git a/include/libcamera/base/bound_method.h b/include/libcamera/base/bound_method.h\nindex dd3488eeb..47e0a2475 100644\n--- a/include/libcamera/base/bound_method.h\n+++ b/include/libcamera/base/bound_method.h\n@@ -33,8 +33,9 @@ template<typename R, typename... Args>\n class BoundMethodPack : public BoundMethodPackBase\n {\n public:\n-\tBoundMethodPack(const Args &... args)\n-\t\t: args_(args...)\n+\ttemplate<typename... Ts>\n+\tBoundMethodPack(Ts &&...args)\n+\t\t: args_(std::forward<Ts>(args)...)\n \t{\n \t}\n \n@@ -51,8 +52,9 @@ template<typename... Args>\n class BoundMethodPack<void, Args...> : public BoundMethodPackBase\n {\n public:\n-\tBoundMethodPack(const Args &... args)\n-\t\t: args_(args...)\n+\ttemplate<typename... Ts>\n+\tBoundMethodPack(Ts &&...args)\n+\t\t: args_(std::forward<Ts>(args)...)\n \t{\n \t}\n \n@@ -136,23 +138,23 @@ public:\n \n \tBoundMethodFunctor(T *obj, Object *object, Func func,\n \t\t\t   ConnectionType type = ConnectionTypeAuto)\n-\t\t: BoundMethodArgs<R, Args...>(obj, object, type), func_(func)\n+\t\t: BoundMethodArgs<R, Args...>(obj, object, type), func_(std::move(func))\n \t{\n \t}\n \n \tR activate(Args... args, bool deleteMethod = false) override\n \t{\n \t\tif (!this->object_)\n-\t\t\treturn func_(args...);\n+\t\t\treturn func_(std::forward<Args>(args)...);\n \n-\t\tauto pack = std::make_shared<PackType>(args...);\n+\t\tauto pack = std::make_shared<PackType>(std::forward<Args>(args)...);\n \t\tbool sync = BoundMethodBase::activatePack(pack, deleteMethod);\n \t\treturn sync ? pack->returnValue() : R();\n \t}\n \n \tR invoke(Args... args) override\n \t{\n-\t\treturn func_(args...);\n+\t\treturn func_(std::forward<Args>(args)...);\n \t}\n \n private:\n@@ -177,10 +179,10 @@ public:\n \t{\n \t\tif (!this->object_) {\n \t\t\tT *obj = static_cast<T *>(this->obj_);\n-\t\t\treturn (obj->*func_)(args...);\n+\t\t\treturn (obj->*func_)(std::forward<Args>(args)...);\n \t\t}\n \n-\t\tauto pack = std::make_shared<PackType>(args...);\n+\t\tauto pack = std::make_shared<PackType>(std::forward<Args>(args)...);\n \t\tbool sync = BoundMethodBase::activatePack(pack, deleteMethod);\n \t\treturn sync ? pack->returnValue() : R();\n \t}\n@@ -188,7 +190,7 @@ public:\n \tR invoke(Args... args) override\n \t{\n \t\tT *obj = static_cast<T *>(this->obj_);\n-\t\treturn (obj->*func_)(args...);\n+\t\treturn (obj->*func_)(std::forward<Args>(args)...);\n \t}\n \n private:\n@@ -209,7 +211,7 @@ public:\n \n \tR activate(Args... args, [[maybe_unused]] bool deleteMethod = false) override\n \t{\n-\t\treturn (*func_)(args...);\n+\t\treturn (*func_)(std::forward<Args>(args)...);\n \t}\n \n \tR invoke(Args...) override\n",
    "prefixes": [
        "v1"
    ]
}