Show a patch.

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

{
    "id": 10233,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/10233/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/10233/",
    "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": "<20201024171225.14483-1-laurent.pinchart@ideasonboard.com>",
    "date": "2020-10-24T17:12:25",
    "name": "[libcamera-devel] libcamera: span: Make constructors explicit as required by C++20",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "3a102a43f4c11a8fd8794a925aa0eb91d3d12ae5",
    "submitter": {
        "id": 2,
        "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api",
        "name": "Laurent Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/10233/mbox/",
    "series": [
        {
            "id": 1412,
            "url": "https://patchwork.libcamera.org/api/1.1/series/1412/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1412",
            "date": "2020-10-24T17:12:25",
            "name": "[libcamera-devel] libcamera: span: Make constructors explicit as required by C++20",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/1412/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/10233/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/10233/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 0C0A7BDB13\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat, 24 Oct 2020 17:13:19 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 810F861DD3;\n\tSat, 24 Oct 2020 19:13:18 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 72D31605BF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 24 Oct 2020 19:13:17 +0200 (CEST)",
            "from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id E442F116B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 24 Oct 2020 19:13:16 +0200 (CEST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"REU5XG2F\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1603559597;\n\tbh=hKKrij3PmDJC0J6GqceoZi1TLpOg9WwQkEqbbPc4YVs=;\n\th=From:To:Subject:Date:From;\n\tb=REU5XG2FYEpznV5Lz4jRbZA7RaPz6ihFMx/i+KKPy6ADSeuW4Of05pG67o1WOFimV\n\tOPGJQCJLKPJyoxGFgJrvBDJgB5qPmZ0F0GdgWfodvRoknxKnE4stKTXBfPu8ungRMl\n\ty3GMB8wJgCVh/hygjLgEIhtzmpbK+G0izYVjC3h4=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Sat, 24 Oct 2020 20:12:25 +0300",
        "Message-Id": "<20201024171225.14483-1-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.27.0",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH] libcamera: span: Make constructors\n\texplicit as required by C++20",
        "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>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "The C++20 std::span class, after which Span is modelled, specifies four\nconstructors as explicit when extent is not dynamic_extent. Align our\nimplementation with those requirements.\n\nA careful reviewer may notice that this change addresses five\nconstructors, not four. The reason is that the two constructors taking\nContainer and const Container parameters are not specified in C++20,\nwhich uses a single constructor taking a range parameter instead. As\nranges are not available in C++17, the Container constructors are our\nbest effort at providing a similar feature.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/span.h | 62 ++++++++++++++++++++++++----------------\n 1 file changed, 37 insertions(+), 25 deletions(-)",
    "diff": "diff --git a/include/libcamera/span.h b/include/libcamera/span.h\nindex c0e439923933..b0dec77c6b1b 100644\n--- a/include/libcamera/span.h\n+++ b/include/libcamera/span.h\n@@ -113,12 +113,12 @@ public:\n \t{\n \t}\n \n-\tconstexpr Span(pointer ptr, [[maybe_unused]] size_type count)\n+\texplicit constexpr Span(pointer ptr, [[maybe_unused]] size_type count)\n \t\t: data_(ptr)\n \t{\n \t}\n \n-\tconstexpr Span(pointer first, [[maybe_unused]] pointer last)\n+\texplicit constexpr Span(pointer first, [[maybe_unused]] pointer last)\n \t\t: data_(first)\n \t{\n \t}\n@@ -154,7 +154,7 @@ public:\n \t}\n \n \ttemplate<class Container>\n-\tconstexpr Span(Container &cont,\n+\texplicit constexpr Span(Container &cont,\n \t\t       std::enable_if_t<!details::is_span<Container>::value &&\n \t\t\t\t\t!details::is_array<Container>::value &&\n \t\t\t\t\t!std::is_array<Container>::value &&\n@@ -166,23 +166,23 @@ public:\n \t}\n \n \ttemplate<class Container>\n-\tconstexpr Span(const Container &cont,\n-\t\t       std::enable_if_t<!details::is_span<Container>::value &&\n-\t\t\t\t\t!details::is_array<Container>::value &&\n-\t\t\t\t\t!std::is_array<Container>::value &&\n-\t\t\t\t\tstd::is_convertible<std::remove_pointer_t<decltype(utils::data(cont))> (*)[],\n-\t\t\t\t\t\t\t    element_type (*)[]>::value,\n-\t\t\t\t\tstd::nullptr_t> = nullptr)\n+\texplicit constexpr Span(const Container &cont,\n+\t\t\t\tstd::enable_if_t<!details::is_span<Container>::value &&\n+\t\t\t\t\t\t !details::is_array<Container>::value &&\n+\t\t\t\t\t\t !std::is_array<Container>::value &&\n+\t\t\t\t\t\t std::is_convertible<std::remove_pointer_t<decltype(utils::data(cont))> (*)[],\n+\t\t\t\t\t\t\t\t     element_type (*)[]>::value,\n+\t\t\t\t\t\t std::nullptr_t> = nullptr)\n \t\t: data_(utils::data(cont))\n \t{\n \t\tstatic_assert(utils::size(cont) == Extent, \"Size mismatch\");\n \t}\n \n \ttemplate<class U, std::size_t N>\n-\tconstexpr Span(const Span<U, N> &s,\n-\t\t       std::enable_if_t<std::is_convertible<U (*)[], element_type (*)[]>::value &&\n-\t\t\t\t\tN == Extent,\n-\t\t\t\t\tstd::nullptr_t> = nullptr) noexcept\n+\texplicit constexpr Span(const Span<U, N> &s,\n+\t\t\t\tstd::enable_if_t<std::is_convertible<U (*)[], element_type (*)[]>::value &&\n+\t\t\t\t\t\t N == Extent,\n+\t\t\t\t\t\t std::nullptr_t> = nullptr) noexcept\n \t\t: data_(s.data())\n \t{\n \t}\n@@ -212,24 +212,24 @@ public:\n \tconstexpr Span<element_type, Count> first() const\n \t{\n \t\tstatic_assert(Count <= Extent, \"Count larger than size\");\n-\t\treturn { data(), Count };\n+\t\treturn Span<element_type, Count>{ data(), Count };\n \t}\n \n \tconstexpr Span<element_type, dynamic_extent> first(std::size_t Count) const\n \t{\n-\t\treturn { data(), Count };\n+\t\treturn Span<element_type, dynamic_extent>{ data(), Count };\n \t}\n \n \ttemplate<std::size_t Count>\n \tconstexpr Span<element_type, Count> last() const\n \t{\n \t\tstatic_assert(Count <= Extent, \"Count larger than size\");\n-\t\treturn { data() + size() - Count, Count };\n+\t\treturn Span<element_type, Count>{ data() + size() - Count, Count };\n \t}\n \n \tconstexpr Span<element_type, dynamic_extent> last(std::size_t Count) const\n \t{\n-\t\treturn { data() + size() - Count, Count };\n+\t\treturn Span<element_type, dynamic_extent>{ data() + size() - Count, Count };\n \t}\n \n \ttemplate<std::size_t Offset, std::size_t Count = dynamic_extent>\n@@ -238,13 +238,19 @@ public:\n \t\tstatic_assert(Offset <= Extent, \"Offset larger than size\");\n \t\tstatic_assert(Count == dynamic_extent || Count + Offset <= Extent,\n \t\t\t      \"Offset + Count larger than size\");\n-\t\treturn { data() + Offset, Count == dynamic_extent ? size() - Offset : Count };\n+\t\treturn Span<element_type, Count != dynamic_extent ? Count : Extent - Offset>{\n+\t\t\tdata() + Offset,\n+\t\t\tCount == dynamic_extent ? size() - Offset : Count\n+\t\t};\n \t}\n \n \tconstexpr Span<element_type, dynamic_extent>\n \tsubspan(std::size_t Offset, std::size_t Count = dynamic_extent) const\n \t{\n-\t\treturn { data() + Offset, Count == dynamic_extent ? size() - Offset : Count };\n+\t\treturn Span<element_type, dynamic_extent>{\n+\t\t\tdata() + Offset,\n+\t\t\tCount == dynamic_extent ? size() - Offset : Count\n+\t\t};\n \t}\n \n private:\n@@ -371,7 +377,7 @@ public:\n \ttemplate<std::size_t Count>\n \tconstexpr Span<element_type, Count> first() const\n \t{\n-\t\treturn { data(), Count };\n+\t\treturn Span<element_type, Count>{ data(), Count };\n \t}\n \n \tconstexpr Span<element_type, dynamic_extent> first(std::size_t Count) const\n@@ -382,24 +388,30 @@ public:\n \ttemplate<std::size_t Count>\n \tconstexpr Span<element_type, Count> last() const\n \t{\n-\t\treturn { data() + size() - Count, Count };\n+\t\treturn Span<element_type, Count>{ data() + size() - Count, Count };\n \t}\n \n \tconstexpr Span<element_type, dynamic_extent> last(std::size_t Count) const\n \t{\n-\t\treturn { data() + size() - Count, Count };\n+\t\treturn Span<element_type, dynamic_extent>{ data() + size() - Count, Count };\n \t}\n \n \ttemplate<std::size_t Offset, std::size_t Count = dynamic_extent>\n \tconstexpr Span<element_type, Count> subspan() const\n \t{\n-\t\treturn { data() + Offset, Count == dynamic_extent ? size() - Offset : Count };\n+\t\treturn Span<element_type, Count>{\n+\t\t\tdata() + Offset,\n+\t\t\tCount == dynamic_extent ? size() - Offset : Count\n+\t\t};\n \t}\n \n \tconstexpr Span<element_type, dynamic_extent>\n \tsubspan(std::size_t Offset, std::size_t Count = dynamic_extent) const\n \t{\n-\t\treturn { data() + Offset, Count == dynamic_extent ? size() - Offset : Count };\n+\t\treturn Span<element_type, dynamic_extent>{\n+\t\t\tdata() + Offset,\n+\t\t\tCount == dynamic_extent ? size() - Offset : Count\n+\t\t};\n \t}\n \n private:\n",
    "prefixes": [
        "libcamera-devel"
    ]
}