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 62D033857439 for ; Fri, 1 Oct 2021 22:30:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 62D033857439 Received: from mail-vs1-f70.google.com (mail-vs1-f70.google.com [209.85.217.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-133-NTHxG9R3NRmqVk2ITkIBcw-1; Fri, 01 Oct 2021 18:30:08 -0400 X-MC-Unique: NTHxG9R3NRmqVk2ITkIBcw-1 Received: by mail-vs1-f70.google.com with SMTP id v12-20020a672f0c000000b002d7c2f1d9ffso2187509vsv.14 for ; Fri, 01 Oct 2021 15:30:07 -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=PBvDzDk5rj80Z0kUSATGmRQgDzochw1yzBoN0JFRWs0=; b=0oxBbr3NvntRS0JnnvCvDFrQTKhi5dZ7nVqRD2tW+qZWQmZowVmGM+JqRl2cpENrzu FEXHOOTPWW6JwcZuQt6elwlfA1k6Sxq+i9xw+ANHhhFAO2AH+xLkXBhmsdAqbCC8wFP1 Z2QGoOQAhUF5/mKfsuoSdUBfH7wCts8uQbpx0KVd4lXehrtbqZJxlM3xAVFH2T54j4pM LEKesmuUN38ZElPmIILpK+z7Gf2Igltq6co76MoUmVf7sqpkNDdPuomnDcKbay+FT42T rYn9yS10pHkDx5Sj4Zimvoj7P5gZ0JYuCkW7iwYyrm/l0CZiAK0K8xmgCr3YK2xC8RNx hYOQ== X-Gm-Message-State: AOAM532bvb8RbC0TOZQgRJIa6/zkxsp4qLyYSXuzYbldsgo62rxFW31K Z1Wwp7bQgdN/HZ1IKQ37Y94kOIGa/EXoB1CPHt0dAIMvstTgoCkRYmrxcFdLe29LPt6gFlzaa7x qldTu9wgXmHrwAiUmhFl8uxx+ESBFjX4= X-Received: by 2002:a05:6102:34eb:: with SMTP id bi11mr6893129vsb.4.1633127407578; Fri, 01 Oct 2021 15:30:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCQBsDc6mhavFyk3ox0mmJtFNBMYp4RK2daLnvL4GFN5TEvtRuu/fAWnve0Wx+2V41N7vEJpitvf7qPY8lRXE= X-Received: by 2002:a05:6102:34eb:: with SMTP id bi11mr6893118vsb.4.1633127407362; Fri, 01 Oct 2021 15:30:07 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Jonathan Wakely Date: Fri, 1 Oct 2021 23:29:56 +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=-4.0 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=unavailable 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: Fri, 01 Oct 2021 22:30:14 -0000 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 was > wrong and added tests on it. Oops, thanks! > For _Safe_iterator maybe I should specialize only when instantiated with > __normal_iterator ? Or maybe limit to random_access_iterator_tag ? Yes, I think that's a good idea, maybe only for __normal_iterator. I think that should cover all the cases we actually need to support. And could you change the existing pointer_traits<__normal_iterator> 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.) > Whatever the pointer_to implementation is problematic, we can only > produce singular iterator as I did ifor now. Hmm, yes. I think that's OK, because I don't think anybody is actually going to use that function. What matters is that it works with std::__to_address for C++17 mode, and that doesn't depend on pointer_to, so it's OK if it doesn't work usefully. Thanks!