From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 9C5113857004 for ; Sat, 2 Oct 2021 20:28:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9C5113857004 Received: from mail-ua1-f71.google.com (mail-ua1-f71.google.com [209.85.222.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-593-RBIr9rjeN1iMDNg5If6QGg-1; Sat, 02 Oct 2021 16:28:23 -0400 X-MC-Unique: RBIr9rjeN1iMDNg5If6QGg-1 Received: by mail-ua1-f71.google.com with SMTP id 63-20020a9f2445000000b002c4023afb53so6685859uaq.17 for ; Sat, 02 Oct 2021 13:28:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=bj8p6ilB4wGVGnRFEV6rNweSFRxtq1mjHcgm9WmCEdc=; b=dBmzejG0rWQpglG8/FnFnNxOhEQ5BvWjYV0h9Zv8C8c32boC/QKrnRlKYjTuemRj15 37fil00qZHXctCuGeuc5gXtsIpjyRuRrOhTN7QUDGT6ovNFA6J5QScWh3om9P8hqK0YL BBynarx/pPDKgrZZl3I3KaRFtmnATpVcfT4olCA11+r2yXMzS5HSOnpCeLjS8bkWIEvD lXuUxBvm6jwEhujgcllOyub7FKbmwrGCDAJnAdjUK/mDL3pgG9+CEyz6cBt3dAosqfL6 7YRmAbIctvGw9GU6KfXzDHaEh8gT8ElLF/DXWUp7rIEI1cSOypC5JTxJw8a8CcwxbwAm 40DA== X-Gm-Message-State: AOAM533Yx+EzaRkNkzbi07QsdsKl4wCV5OodlQXPjN1ZaR1mW8M1MArx 42miOuKfGgGM5dydvixyd4Ok/4KbNtoneUSWpGZiprHNT2jjiSlA34C6TQUOSWKSwNKlrw2e1Ne AoNglAIIe9yxDWFMo71HrjqPVhuqK9vQ= X-Received: by 2002:a67:fe4f:: with SMTP id m15mr9009986vsr.2.1633206503067; Sat, 02 Oct 2021 13:28:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxD0cNLsTxJas1yEB97cYZCp9KXpBcauYDp5plzrzqmssNDcAOb2qPEHfIsCIrxibygHw0A5BorIetWhewgD4E= X-Received: by 2002:a67:fe4f:: with SMTP id m15mr9009983vsr.2.1633206502929; Sat, 02 Oct 2021 13:28:22 -0700 (PDT) MIME-Version: 1.0 References: <0dbec215-2a5f-5291-49d7-afea2cd611a7@gmail.com> In-Reply-To: <0dbec215-2a5f-5291-49d7-afea2cd611a7@gmail.com> From: Jonathan Wakely Date: Sat, 2 Oct 2021 21:28:12 +0100 Message-ID: Subject: Re: [committed] libstdc++: Specialize std::pointer_traits<__normal_iterator> To: =?UTF-8?Q?Fran=C3=A7ois_Dumont?= Cc: "libstdc++" , gcc-patches X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Oct 2021 20:28:25 -0000 On Sat, 2 Oct 2021 at 14:08, Fran=C3=A7ois Dumont wr= ote: > > On 02/10/21 12:29 am, Jonathan Wakely wrote: > > On Thu, 30 Sept 2021 at 21:27, Fran=C3=A7ois Dumont via Libstdc++ > > wrote: > >> Here is the _Safe_iterator one. > >> > >> Doing so I noticed that pointer_traits rebind for __normal_iterator wa= s > >> wrong and added tests on it. > > Oops, thanks! > > > >> For _Safe_iterator maybe I should specialize only when instantiated wi= th > >> __normal_iterator ? Or maybe limit to random_access_iterator_tag ? > > Yes, I think that's a good idea, maybe only for __normal_iterator > C>. I think that should cover all the cases we actually need to > > support. > > > > And could you change the existing pointer_traits<__normal_iterator > C>> partial specialization to only be valid for > > __normal_iterator as well? i.e. only for __normal_iterator that > > wraps a pointer (which is true for string::iterator, vector::iterator > > etc.) > > Is the attached patch what you had in mind ? Yes, although I don't think we need to us __make_not_void for to_pointer, because I don't think we would ever have __normal_iterator. I don't think it will even compile, because void* is not an iterator type, and iterator_traits is invalid (in C++20 it's constrained with is_object_v and before C++20 it will just give an error, because void& is ill-formed).