get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2226669,
    "url": "http://patchwork.ozlabs.org/api/patches/2226669/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/bmm.hhuo2dtkd4.gcc.gcc-TEST.peppe.44.1.2@forge-stage.sourceware.org/",
    "project": {
        "id": 17,
        "url": "http://patchwork.ozlabs.org/api/projects/17/?format=api",
        "name": "GNU Compiler Collection",
        "link_name": "gcc",
        "list_id": "gcc-patches.gcc.gnu.org",
        "list_email": "gcc-patches@gcc.gnu.org",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<bmm.hhuo2dtkd4.gcc.gcc-TEST.peppe.44.1.2@forge-stage.sourceware.org>",
    "list_archive_url": null,
    "date": "2026-04-22T18:10:42",
    "name": "[v1,2/2] libstdc++: add constexpr stable_partition",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "7994b774cdcc3eba868905b59968fa613440abf9",
    "submitter": {
        "id": 93222,
        "url": "http://patchwork.ozlabs.org/api/people/93222/?format=api",
        "name": "peppe via Sourceware Forge",
        "email": "forge-bot+peppe@forge-stage.sourceware.org"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/bmm.hhuo2dtkd4.gcc.gcc-TEST.peppe.44.1.2@forge-stage.sourceware.org/mbox/",
    "series": [
        {
            "id": 501068,
            "url": "http://patchwork.ozlabs.org/api/series/501068/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=501068",
            "date": "2026-04-22T18:10:42",
            "name": "WIP: more_constexpr_stable_algorithms",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/501068/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2226669/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2226669/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "gcc-patches@gcc.gnu.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@legolas.ozlabs.org",
            "gcc-patches@gcc.gnu.org"
        ],
        "Authentication-Results": [
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=38.145.34.32; helo=vm01.sourceware.org;\n envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org;\n receiver=patchwork.ozlabs.org)",
            "sourceware.org; dmarc=none (p=none dis=none)\n header.from=forge-stage.sourceware.org",
            "sourceware.org;\n spf=pass smtp.mailfrom=forge-stage.sourceware.org",
            "server2.sourceware.org;\n arc=none smtp.remote-ip=38.145.34.39"
        ],
        "Received": [
            "from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g16r52stjz1yD5\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 23 Apr 2026 04:16:53 +1000 (AEST)",
            "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 84F834AA397D\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 22 Apr 2026 18:16:51 +0000 (GMT)",
            "from forge-stage.sourceware.org (vm08.sourceware.org [38.145.34.39])\n by sourceware.org (Postfix) with ESMTPS id 824524BBCDC5\n for <gcc-patches@gcc.gnu.org>; Wed, 22 Apr 2026 18:11:37 +0000 (GMT)",
            "from forge-stage.sourceware.org (localhost [IPv6:::1])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256)\n (No client certificate requested)\n by forge-stage.sourceware.org (Postfix) with ESMTPS id 4FF974340C\n for <gcc-patches@gcc.gnu.org>; Wed, 22 Apr 2026 18:11:37 +0000 (UTC)"
        ],
        "DKIM-Filter": [
            "OpenDKIM Filter v2.11.0 sourceware.org 84F834AA397D",
            "OpenDKIM Filter v2.11.0 sourceware.org 824524BBCDC5"
        ],
        "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 824524BBCDC5",
        "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 824524BBCDC5",
        "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776881497; cv=none;\n b=ExYnuEHEc2HXLkIvj0pjWy5ec6556iHbEa9kVV/HATd4new79kALN9hlVTzaaeHlC4Dw9fal0uHBnTzNec3cBmOYv+S+jxQyd9JkXWZUB8Raw9FgwZwzV6WGst2okHUxvsrBLyvn0Jeb6DoziX6ywmugbb414m3U+7T/jQv+A0Q=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1776881497; c=relaxed/simple;\n bh=BGit1KnNN0m6OLa/zjmOx4DnaHNcCahNyBYwCmisFF4=;\n h=From:Date:Subject:To:Message-ID;\n b=golhKrgIF2d0itFWLjAHcaMM+zaa0OTjPea7H+n09WMqFxRdzNT6cNdNcs4Ks6XbmOT2qoT0q/+GBIpTVZYDnumaDJ3MAHErX4r++3kYFV0NX2oU/Tv9D1m+GHreC0JGGmuipZnr5cDRcLwvmW+l/ZqPcNruOlEI73bmG7b2I+U=",
        "ARC-Authentication-Results": "i=1; server2.sourceware.org",
        "From": "peppe via Sourceware Forge <forge-bot+peppe@forge-stage.sourceware.org>",
        "Date": "Wed, 22 Apr 2026 18:10:42 +0000",
        "Subject": "[PATCH v1 2/2] libstdc++: add constexpr stable_partition",
        "To": "gcc-patches mailing list <gcc-patches@gcc.gnu.org>",
        "Message-ID": "\n <bmm.hhuo2dtkd4.gcc.gcc-TEST.peppe.44.1.2@forge-stage.sourceware.org>",
        "X-Mailer": "batrachomyomachia",
        "X-Requested-Reviewer": "redi",
        "X-Pull-Request-Organization": "gcc",
        "X-Pull-Request-Repository": "gcc-TEST",
        "X-Pull-Request": "https://forge.sourceware.org/gcc/gcc-TEST/pulls/44",
        "References": "\n <bmm.hhuo2dtkd4.gcc.gcc-TEST.peppe.44.1.0@forge-stage.sourceware.org>",
        "In-Reply-To": "\n <bmm.hhuo2dtkd4.gcc.gcc-TEST.peppe.44.1.0@forge-stage.sourceware.org>",
        "X-Patch-URL": "\n https://forge.sourceware.org/peppe/gcc-TEST/commit/bfb9835a6472095f7e80eb19c7074686efd4bc96",
        "X-BeenThere": "gcc-patches@gcc.gnu.org",
        "X-Mailman-Version": "2.1.30",
        "Precedence": "list",
        "List-Id": "Gcc-patches mailing list <gcc-patches.gcc.gnu.org>",
        "List-Unsubscribe": "<https://gcc.gnu.org/mailman/options/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe>",
        "List-Archive": "<https://gcc.gnu.org/pipermail/gcc-patches/>",
        "List-Post": "<mailto:gcc-patches@gcc.gnu.org>",
        "List-Help": "<mailto:gcc-patches-request@gcc.gnu.org?subject=help>",
        "List-Subscribe": "<https://gcc.gnu.org/mailman/listinfo/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe>",
        "Reply-To": "gcc-patches mailing list <gcc-patches@gcc.gnu.org>,\n peppe@noreply.localhost",
        "Errors-To": "gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org"
    },
    "content": "From: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>\n\nThis completes the implementation of P2562R1 for C++26.\n\nUnlike the other constexpr algorithms of the same family,\nstable_partition does not have a constexpr-friendly version \"ready to\nuse\" during constant evaluation. In fact, it is not even available on\nfreestanding, because it always allocates a temporary memory buffer.\n\nThis commit implements the simplest possible strategy: during constant\nevaluation allocate a buffer of length 1 on the stack, and use that as\na working area.\n\nlibstdc++-v3/ChangeLog:\n\n\t* include/bits/algorithmfwd.h (stable_partition): Mark it\n\tas constexpr for C++26.\n\t* include/bits/ranges_algo.h (__stable_partition_fn): Likewise.\n\t* include/bits/stl_algo.h (stable_partition): Mark it as\n\tconstexpr for C++26; during constant evaluation use a new\n\tcodepath where a temporary buffer of 1 element is used.\n\t* testsuite/25_algorithms/headers/algorithm/synopsis.cc\n\t(stable_partition): Add constexpr.\n\t* testsuite/25_algorithms/stable_partition/constexpr.cc: New test.\n---\n libstdc++-v3/include/bits/algorithmfwd.h      |  1 +\n libstdc++-v3/include/bits/ranges_algo.h       |  2 +\n libstdc++-v3/include/bits/stl_algo.h          | 21 ++++++++-\n .../headers/algorithm/synopsis.cc             |  1 +\n .../stable_partition/constexpr.cc             | 44 +++++++++++++++++++\n 5 files changed, 67 insertions(+), 2 deletions(-)\n create mode 100644 libstdc++-v3/testsuite/25_algorithms/stable_partition/constexpr.cc",
    "diff": "diff --git a/libstdc++-v3/include/bits/algorithmfwd.h b/libstdc++-v3/include/bits/algorithmfwd.h\nindex 05894b580028..a727b2783814 100644\n--- a/libstdc++-v3/include/bits/algorithmfwd.h\n+++ b/libstdc++-v3/include/bits/algorithmfwd.h\n@@ -649,6 +649,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)\n \n #if _GLIBCXX_HOSTED\n   template<typename _BIter, typename _Predicate>\n+    _GLIBCXX26_CONSTEXPR\n     _BIter\n     stable_partition(_BIter, _BIter, _Predicate);\n #endif\ndiff --git a/libstdc++-v3/include/bits/ranges_algo.h b/libstdc++-v3/include/bits/ranges_algo.h\nindex 2814d90061cc..f36e7dd59911 100644\n--- a/libstdc++-v3/include/bits/ranges_algo.h\n+++ b/libstdc++-v3/include/bits/ranges_algo.h\n@@ -2389,6 +2389,7 @@ namespace ranges\n \t     typename _Proj = identity,\n \t     indirect_unary_predicate<projected<_Iter, _Proj>> _Pred>\n       requires permutable<_Iter>\n+      _GLIBCXX26_CONSTEXPR\n       subrange<_Iter>\n       operator()(_Iter __first, _Sent __last,\n \t\t _Pred __pred, _Proj __proj = {}) const\n@@ -2404,6 +2405,7 @@ namespace ranges\n \t     indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>>\n \t       _Pred>\n       requires permutable<iterator_t<_Range>>\n+      _GLIBCXX26_CONSTEXPR\n       borrowed_subrange_t<_Range>\n       operator()(_Range&& __r, _Pred __pred, _Proj __proj = {}) const\n       {\ndiff --git a/libstdc++-v3/include/bits/stl_algo.h b/libstdc++-v3/include/bits/stl_algo.h\nindex bb7dbfbd8e04..71ead103d2bf 100644\n--- a/libstdc++-v3/include/bits/stl_algo.h\n+++ b/libstdc++-v3/include/bits/stl_algo.h\n@@ -1447,6 +1447,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)\n   /// move-assign an element onto itself.\n   template<typename _ForwardIterator, typename _Pointer, typename _Predicate,\n \t   typename _Distance>\n+    _GLIBCXX26_CONSTEXPR\n     _ForwardIterator\n     __stable_partition_adaptive(_ForwardIterator __first,\n \t\t\t\t_ForwardIterator __last,\n@@ -1507,6 +1508,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)\n     }\n \n   template<typename _ForwardIterator, typename _Predicate>\n+    _GLIBCXX26_CONSTEXPR\n     _ForwardIterator\n     __stable_partition(_ForwardIterator __first, _ForwardIterator __last,\n \t\t       _Predicate __pred)\n@@ -1521,11 +1523,25 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)\n       typedef typename iterator_traits<_ForwardIterator>::difference_type\n \t_DistanceType;\n \n+      const _DistanceType __len = std::distance(__first, __last);\n+\n+#if __glibcxx_constexpr_algorithms >= 202306L // >= C++26\n+      if consteval {\n+\t// Simulate a _Temporary_buffer of length 1:\n+\t_ValueType __buf = std::move(*__first);\n+\t*__first = std::move(__buf);\n+\treturn std::__stable_partition_adaptive(__first, __last, __pred,\n+\t\t\t\t\t\t__len,\n+\t\t\t\t\t\t&__buf,\n+\t\t\t\t\t\t_DistanceType(1));\n+      }\n+#endif\n+\n       _Temporary_buffer<_ForwardIterator, _ValueType>\n-\t__buf(__first, std::distance(__first, __last));\n+\t__buf(__first, __len);\n       return\n \tstd::__stable_partition_adaptive(__first, __last, __pred,\n-\t\t\t\t\t _DistanceType(__buf.requested_size()),\n+\t\t\t\t\t __len,\n \t\t\t\t\t __buf.begin(),\n \t\t\t\t\t _DistanceType(__buf.size()));\n     }\n@@ -1548,6 +1564,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)\n    *  relative ordering after calling @p stable_partition().\n   */\n   template<typename _ForwardIterator, typename _Predicate>\n+    _GLIBCXX26_CONSTEXPR\n     inline _ForwardIterator\n     stable_partition(_ForwardIterator __first, _ForwardIterator __last,\n \t\t     _Predicate __pred)\ndiff --git a/libstdc++-v3/testsuite/25_algorithms/headers/algorithm/synopsis.cc b/libstdc++-v3/testsuite/25_algorithms/headers/algorithm/synopsis.cc\nindex 8d5c1fb7ac73..072dd0781046 100644\n--- a/libstdc++-v3/testsuite/25_algorithms/headers/algorithm/synopsis.cc\n+++ b/libstdc++-v3/testsuite/25_algorithms/headers/algorithm/synopsis.cc\n@@ -349,6 +349,7 @@ namespace std\n     partition(_BIter, _BIter, _Predicate);\n \n   template<typename _BIter, typename _Predicate>\n+    _GLIBCXX26_CONSTEXPR\n     _BIter\n     stable_partition(_BIter, _BIter, _Predicate);\n \ndiff --git a/libstdc++-v3/testsuite/25_algorithms/stable_partition/constexpr.cc b/libstdc++-v3/testsuite/25_algorithms/stable_partition/constexpr.cc\nnew file mode 100644\nindex 000000000000..8decc93eb827\n--- /dev/null\n+++ b/libstdc++-v3/testsuite/25_algorithms/stable_partition/constexpr.cc\n@@ -0,0 +1,44 @@\n+// { dg-do compile { target c++26 } }\n+\n+#include <algorithm>\n+#include <array>\n+\n+constexpr auto\n+create_array()\n+{\n+  return std::to_array({0, 10, 1, 2, 3, 3, 4, -1, -2, -4, 5, 6});\n+}\n+\n+constexpr bool\n+test01()\n+{\n+  auto ar = create_array();\n+  auto pred = [](int i) { return i % 2 == 0; };\n+  std::stable_partition(ar.begin(), ar.end(), pred);\n+  return std::is_partitioned(ar.begin(), ar.end(), pred);\n+}\n+\n+static_assert(test01());\n+\n+constexpr bool\n+test02()\n+{\n+  auto ar = create_array();\n+  auto pred = [](int i) { return i % 2 == 0; };\n+  std::ranges::stable_partition(ar, pred);\n+  return std::ranges::is_partitioned(ar, pred);\n+}\n+\n+static_assert(test02());\n+\n+constexpr bool\n+test03()\n+{\n+  auto ar = create_array();\n+  auto pred = [](int i) { return i % 2 == 0; };\n+  auto proj = [](int i) { return i + 1; };\n+  std::ranges::stable_partition(ar, pred, proj);\n+  return std::ranges::is_partitioned(ar, pred, proj);\n+}\n+\n+static_assert(test03());\n",
    "prefixes": [
        "v1",
        "2/2"
    ]
}