[{"id":3681909,"web_url":"http://patchwork.ozlabs.org/comment/3681909/","msgid":"<CACb0b4nYFyA5rKQwAJbGZYL9oi4mjOMLRmRc2_Z_KdU2ymyCeg@mail.gmail.com>","list_archive_url":null,"date":"2026-04-24T09:20:50","subject":"Re: [PATCH] libstdc+: Provide iterator type for basic_const_iterator.","submitter":{"id":48004,"url":"http://patchwork.ozlabs.org/api/people/48004/","name":"Jonathan Wakely","email":"jwakely@redhat.com"},"content":"On Fri, 24 Apr 2026 at 09:57, Tomasz Kamiński <tkaminsk@redhat.com> wrote:\n>\n> This resolves 4253. basic_const_iterator should provide iterator_type.\n\nI think this would be more readable as:\n\nThis resolves LWG 4253, \"basic_const_iterator should provide iterator_type\"\nwhich was approved in Kona 2025.\n\nOK with that change, thanks\n\n\n>\n> libstdc++-v3/ChangeLog:\n>\n>         * include/bits/stl_iterator.h (basic_const_iterator::iterator_type):\n>         Define.\n>         * testsuite/24_iterators/const_iterator/1.cc: Tests for\n>         iterator_type.\n> ---\n> Tested on x86_64-linux. OK for trunk?\n>\n>  libstdc++-v3/include/bits/stl_iterator.h                | 3 +++\n>  libstdc++-v3/testsuite/24_iterators/const_iterator/1.cc | 2 ++\n>  2 files changed, 5 insertions(+)\n>\n> diff --git a/libstdc++-v3/include/bits/stl_iterator.h b/libstdc++-v3/include/bits/stl_iterator.h\n> index f16f591ad63..6439deb608a 100644\n> --- a/libstdc++-v3/include/bits/stl_iterator.h\n> +++ b/libstdc++-v3/include/bits/stl_iterator.h\n> @@ -2691,6 +2691,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n>      template<input_iterator _It2> friend class basic_const_iterator;\n>\n>    public:\n> +    // _GLIBCXX_RESOLVE_LIB_DEFECTS\n> +    // 4253. basic_const_iterator should provide iterator_type\n> +    using iterator_type = _It;\n>      using iterator_concept = decltype(_S_iter_concept());\n>      using value_type = iter_value_t<_It>;\n>      using difference_type = iter_difference_t<_It>;\n> diff --git a/libstdc++-v3/testsuite/24_iterators/const_iterator/1.cc b/libstdc++-v3/testsuite/24_iterators/const_iterator/1.cc\n> index f2bcad4f09c..7f791ddbef9 100644\n> --- a/libstdc++-v3/testsuite/24_iterators/const_iterator/1.cc\n> +++ b/libstdc++-v3/testsuite/24_iterators/const_iterator/1.cc\n> @@ -29,6 +29,7 @@ test01()\n>    else\n>      {\n>        using Wrapped = std::basic_const_iterator<Iter>;\n> +      static_assert( std::same_as<typename Wrapped::iterator_type, Iter> );\n>\n>        static_assert( std::same_as<std::const_iterator<Iter>, Wrapped> );\n>        static_assert( std::same_as<std::const_sentinel<Iter>, Wrapped> );\n> @@ -64,6 +65,7 @@ test02()\n>      {\n>        static_assert( !ranges::constant_range<Range> );\n>        using Wrapped = std::basic_const_iterator<ranges::iterator_t<Range>>;\n> +      static_assert( std::same_as<typename Wrapped::iterator_type, ranges::iterator_t<Range>> );\n>\n>        if constexpr (Constable)\n>         {\n> --\n> 2.53.0\n>","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\tdkim=pass (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=Jbxs9Igb;\n\tdkim-atps=neutral","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;\n\tdkim=pass (1024-bit key,\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=Jbxs9Igb","sourceware.org; dmarc=pass (p=quarantine dis=none)\n header.from=redhat.com","sourceware.org; spf=pass smtp.mailfrom=redhat.com","server2.sourceware.org;\n arc=none smtp.remote-ip=170.10.129.124"],"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 4g26sq1Gj0z1yD5\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 24 Apr 2026 19:21:49 +1000 (AEST)","from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 229014BB3BD0\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 24 Apr 2026 09:21:48 +0000 (GMT)","from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.129.124])\n by sourceware.org (Postfix) with ESMTP id 9DFAB4BA79BF\n for <gcc-patches@gcc.gnu.org>; Fri, 24 Apr 2026 09:21:09 +0000 (GMT)","from mail-yx1-f70.google.com (mail-yx1-f70.google.com\n [74.125.224.70]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n us-mta-451-xLIzlkKLNKWrdaIB48vXTg-1; Fri, 24 Apr 2026 05:21:07 -0400","by mail-yx1-f70.google.com with SMTP id\n 956f58d0204a3-6545a37ea2dso5030139d50.0\n for <gcc-patches@gcc.gnu.org>; Fri, 24 Apr 2026 02:21:07 -0700 (PDT)"],"DKIM-Filter":["OpenDKIM Filter v2.11.0 sourceware.org 229014BB3BD0","OpenDKIM Filter v2.11.0 sourceware.org 9DFAB4BA79BF"],"DMARC-Filter":"OpenDMARC Filter v1.4.2 sourceware.org 9DFAB4BA79BF","ARC-Filter":"OpenARC Filter v1.0.0 sourceware.org 9DFAB4BA79BF","ARC-Seal":"i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1777022469; cv=none;\n b=PfKYLL3Wmi4iXOLu3gvqf4hp6eSal5m8w+ilRkgjlagX1DG2ymNNw8NVptJfzS+ZYoE9mTNecYjWBSvJxOOaFlvOS3wL5j1tZuo/VyoXXyDTK3+X4Ph1D1E/8B2z1jj3/gKJCJxC4u0e0hNgNoIUx6uxCV+EHo8K1FD/hGMShJs=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1777022469; c=relaxed/simple;\n bh=a5pSzQDDTA7ageNc2C287qtbpBAWm2Z+YjthPJce/w0=;\n h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To;\n b=SaKx4bJSWTQ2ZZLGOkOljNh9YAxQBu0YlJgLmUJ0U7yoz0t0hk077Koob4U4nkA8fDn4FXIhZiqZ3B9WD70PhyR85P2yRAErti1sH3dFospgWTvgVroARB56b+QIVXC/FboPVhRoUaj+j83XoiXaARDFMncHUIhD4cAwqKE9Hl8=","ARC-Authentication-Results":"i=1; server2.sourceware.org","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1777022469;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=yQY/a5T9nw5gMUFAx5c6wV+fl4BOU8UdO02PsAWPlNs=;\n b=Jbxs9IgbWSYEL1e7KewYvOi8CekLxYjQ66kd9prfosB4xT1d2lq17pEbdmT61Or/wU8inT\n uofwLbm6ZnLuc8oRlzukhLpQ/Z5TiWLOcn74Rj6ZCTgU/I5pVEa53xiZy4cEbiw57xi8sg\n hYmzwYHGAEi+mxa9vG4sywR81FSEpIE=","X-MC-Unique":"xLIzlkKLNKWrdaIB48vXTg-1","X-Mimecast-MFC-AGG-ID":"xLIzlkKLNKWrdaIB48vXTg_1777022467","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1777022467; x=1777627267;\n h=content-transfer-encoding:cc:to:subject:message-id:date:from\n :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=yQY/a5T9nw5gMUFAx5c6wV+fl4BOU8UdO02PsAWPlNs=;\n b=FcjXDN4Hq3i/vnA7/yWipAEPmNubXfh1PihtchkfA50nu57jXEm3ZOcGgjyRqXxnZj\n lmXPCSOFxPzsA7iNh6wfQ5G5q2F+2gI+nLPRXIb9jc/9eKhLtsGdagehLKOKV+GNvTG+\n 1Qgk6UY1gAil+IKyVkZ28PZ/YS8ruuE9j87pozdADdur046MjXRyr0fl6roylNDwCypP\n 9H6pLOdsmuSveyEP4jGJ04iobfP6dmn50LAvFnU4+Y8Y2bR/W6xJ2tR9V4rQtMdb1LFy\n Sav1lSavi8FJR4vDY8TXP715McPxCBbFBR0ykBWeQg9PWqZud1uu++5C6iSQ558i6IKI\n AQ+A==","X-Forwarded-Encrypted":"i=1;\n AFNElJ9dsv6LvXKsOL+bOYMEEi64sw96HCMgaEcJV4SRWB9b6sSKFzCAuAScbOAhAPZbZRjYuQTbJM5N2xzytA==@gcc.gnu.org","X-Gm-Message-State":"AOJu0YzrDouWQEAclUhYWBbtT1UAS0D8RPTGQDsP7IXHZ2/5B/zLkcib\n XJdENpgwuKBQazds/6Jy7f2xqS9BNsoPz2qniJsHWVKIl6lqw2eZufaMyIQwViAfr0Be4xNVTqu\n o+yoDQJU27c1KypHIVETO/aIE/eoKBsa+w3yptOkjDx921RRtjPEGVq5V3+3ZDduxjeWIPdRR48\n VAiNFRQOP864QpXQV+ivFiBcxc5zyL/P4exg==","X-Gm-Gg":"AeBDievQh+nM9ff+GCEuDWi3chacuMOUU6/fZiop1EVK1bOlyvsuTIt/wCRuHRkTuXQ\n 1v570i1CBLuMUAYsESxbD0/NlQS0g79L8O6dHzl3WhYN7m3Pj63kECoxu5bj7sDnEqce4pPiCN5\n f+8Tu/RN4HuFX0+tKrrHCR7pyXc+fduziYLry1ksTn+8JPaH8rxhBYwPh86SYWYDojMQYXcyg6B\n 6GTuHtmVA++CZ7tV4kCgBkf9LIzhaoeCB0qNjLnVXGEtZGAkgHWMKJ8l/XdlZ1johA2RylSmgPC\n dQ==","X-Received":["by 2002:a05:690e:1902:b0:651:c782:6a8 with SMTP id\n 956f58d0204a3-65310805fe4mr26492744d50.15.1777022467324;\n Fri, 24 Apr 2026 02:21:07 -0700 (PDT)","by 2002:a05:690e:1902:b0:651:c782:6a8 with SMTP id\n 956f58d0204a3-65310805fe4mr26492724d50.15.1777022466832; Fri, 24 Apr 2026\n 02:21:06 -0700 (PDT)"],"MIME-Version":"1.0","References":"<20260424085642.804561-1-tkaminsk@redhat.com>","In-Reply-To":"<20260424085642.804561-1-tkaminsk@redhat.com>","From":"Jonathan Wakely <jwakely@redhat.com>","Date":"Fri, 24 Apr 2026 10:20:50 +0100","X-Gm-Features":"AQROBzCBYkMl7T4_d7hcm8MxmkIP5-hYPmu1X7DVfUmYCwXvxhd4ZVDCWKq2kfY","Message-ID":"\n <CACb0b4nYFyA5rKQwAJbGZYL9oi4mjOMLRmRc2_Z_KdU2ymyCeg@mail.gmail.com>","Subject":"Re: [PATCH] libstdc+: Provide iterator type for basic_const_iterator.","To":"=?utf-8?q?Tomasz_Kami=C5=84ski?= <tkaminsk@redhat.com>","Cc":"libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"9M9QEM1Vx3yCrarguFkcmkiBFot82LLE-duEcvx95c4_1777022467","X-Mimecast-Originator":"redhat.com","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable","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>","Errors-To":"gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org"}}]