Patch Detail
Show a patch.
GET /api/patches/2693/?format=api
{ "id": 2693, "url": "https://patchwork.libcamera.org/api/patches/2693/?format=api", "web_url": "https://patchwork.libcamera.org/patch/2693/", "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": "<20200120002437.6633-7-laurent.pinchart@ideasonboard.com>", "date": "2020-01-20T00:24:24", "name": "[libcamera-devel,06/19] libcamera: bound_method: Use std::index_sequence", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "3f5a539341988ccac6afbcc696c06aadacdd07fd", "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/2693/mbox/", "series": [ { "id": 641, "url": "https://patchwork.libcamera.org/api/series/641/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=641", "date": "2020-01-20T00:24:19", "name": "Initial libcamera threading model", "version": 1, "mbox": "https://patchwork.libcamera.org/series/641/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/2693/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/2693/checks/", "tags": {}, "headers": { "Return-Path": "<laurent.pinchart@ideasonboard.com>", "Received": [ "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E9DAA607C4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 20 Jan 2020 01:24:44 +0100 (CET)", "from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 8A625529\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 20 Jan 2020 01:24:44 +0100 (CET)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1579479884;\n\tbh=8HAk4qCr0p0EA2DP7p4x/yStMqE64E+iuD7/sZsNGtE=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=eXAT2eybpvGP29QXxe+hot9TFWuNntOYAN5FBjlrL3pWUHKw6GzA+Z+XVDGGM/1cy\n\tnQAlfxTMJG0SrjcuYMxLna3wD8Y0cJADMpaY+oFcZsJP/1Eca0CRoTT7wnty/OL7cX\n\tDbKRm0TpU+8CSrZ7XqnP01RvmYMTYp9PNbqJZeso=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Mon, 20 Jan 2020 02:24:24 +0200", "Message-Id": "<20200120002437.6633-7-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.24.1", "In-Reply-To": "<20200120002437.6633-1-laurent.pinchart@ideasonboard.com>", "References": "<20200120002437.6633-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 06/19] libcamera: bound_method: Use\n\tstd::index_sequence", "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>", "X-List-Received-Date": "Mon, 20 Jan 2020 00:24:46 -0000" }, "content": "Now that we're using C++-14, replace the manual implementation of\nstd::integer_sequence with std::index_sequence, a specialization of\nstd::integer_sequence with the integer type equal to std::size_t.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/bound_method.h | 38 +++++++++-----------------------\n 1 file changed, 10 insertions(+), 28 deletions(-)", "diff": "diff --git a/include/libcamera/bound_method.h b/include/libcamera/bound_method.h\nindex ca501493bce2..7ffd2e426e18 100644\n--- a/include/libcamera/bound_method.h\n+++ b/include/libcamera/bound_method.h\n@@ -10,6 +10,7 @@\n #include <memory>\n #include <tuple>\n #include <type_traits>\n+#include <utility>\n \n namespace libcamera {\n \n@@ -71,25 +72,6 @@ public:\n \tvirtual void invokePack(BoundMethodPackBase *pack) = 0;\n \n protected:\n-#ifndef __DOXYGEN__\n-\t/*\n-\t * This is a cheap partial implementation of std::integer_sequence<>\n-\t * from C++14.\n-\t */\n-\ttemplate<int...>\n-\tstruct sequence {\n-\t};\n-\n-\ttemplate<int N, int... S>\n-\tstruct generator : generator<N-1, N-1, S...> {\n-\t};\n-\n-\ttemplate<int... S>\n-\tstruct generator<0, S...> {\n-\t\ttypedef sequence<S...> type;\n-\t};\n-#endif\n-\n \tbool activatePack(std::shared_ptr<BoundMethodPackBase> pack,\n \t\t\t bool deleteMethod);\n \n@@ -107,11 +89,11 @@ public:\n \tusing PackType = BoundMethodPack<R, Args...>;\n \n private:\n-\ttemplate<int... S>\n-\tvoid invokePack(BoundMethodPackBase *pack, BoundMethodBase::sequence<S...>)\n+\ttemplate<std::size_t... I>\n+\tvoid invokePack(BoundMethodPackBase *pack, std::index_sequence<I...>)\n \t{\n \t\tPackType *args = static_cast<PackType *>(pack);\n-\t\targs->ret_ = invoke(std::get<S>(args->args_)...);\n+\t\targs->ret_ = invoke(std::get<I>(args->args_)...);\n \t}\n \n public:\n@@ -120,7 +102,7 @@ public:\n \n \tvoid invokePack(BoundMethodPackBase *pack) override\n \t{\n-\t\tinvokePack(pack, typename BoundMethodBase::generator<sizeof...(Args)>::type());\n+\t\tinvokePack(pack, std::make_index_sequence<sizeof...(Args)>{});\n \t}\n \n \tvirtual R activate(Args... args, bool deleteMethod = false) = 0;\n@@ -134,12 +116,12 @@ public:\n \tusing PackType = BoundMethodPack<void, Args...>;\n \n private:\n-\ttemplate<int... S>\n-\tvoid invokePack(BoundMethodPackBase *pack, BoundMethodBase::sequence<S...>)\n+\ttemplate<std::size_t... I>\n+\tvoid invokePack(BoundMethodPackBase *pack, std::index_sequence<I...>)\n \t{\n-\t\t/* args is effectively unused when the sequence S is empty. */\n+\t\t/* args is effectively unused when the sequence I is empty. */\n \t\tPackType *args [[gnu::unused]] = static_cast<PackType *>(pack);\n-\t\tinvoke(std::get<S>(args->args_)...);\n+\t\tinvoke(std::get<I>(args->args_)...);\n \t}\n \n public:\n@@ -148,7 +130,7 @@ public:\n \n \tvoid invokePack(BoundMethodPackBase *pack) override\n \t{\n-\t\tinvokePack(pack, typename BoundMethodBase::generator<sizeof...(Args)>::type());\n+\t\tinvokePack(pack, std::make_index_sequence<sizeof...(Args)>{});\n \t}\n \n \tvirtual void activate(Args... args, bool deleteMethod = false) = 0;\n", "prefixes": [ "libcamera-devel", "06/19" ] }