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 B51C03858428 for ; Sat, 2 Oct 2021 20:24:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B51C03858428 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-361-VrpvpWFBMlupQa4Hk7sQHQ-1; Sat, 02 Oct 2021 16:24:52 -0400 X-MC-Unique: VrpvpWFBMlupQa4Hk7sQHQ-1 Received: by mail-ua1-f71.google.com with SMTP id q8-20020ab070a8000000b002c9773bfaf8so6695761ual.8 for ; Sat, 02 Oct 2021 13:24:52 -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=k6m7YgTN9akYt6NlGHVlhCA1KTXRKumFG2CsFByJwBU=; b=tQsQmI/ny5dKX11sRENwnf+75LLcSGlIrPCqyteqCM5VdVZlHSOt7/Gka2479mz59U 2v0RxWFSFVcU59P9TAat1PBQeEZGsDokT+0tAVuBh9VPJpJrSrFC4nUFb+KPh8iPgTbS DO2bd/RR+BsHrYvnyjIAi8KrOgUbYUb+oLVvj2HqQychgCaZhTR2gLjRNxda4ovo9w0c QOtl81XLrar2bBWMywIFeqPUdni7ch1OTia8DcsDtWAj6oLLcDrZJ0qU1AsetqVFi2Z1 OAA35wGqYIA912gVieu2FbBLJ4CFknS7krkznks1w5gjTmA+McHxfcSM+bOpbIL8U4Cy FTCA== X-Gm-Message-State: AOAM530pFGSIs0vWkiP11U2YFefhmmPC/E3ZoZiBKnfOHPFevG2Zpddu n1BdnBfhAORkxg+JNf3WLIAY+brLrEuSY5qJl4OBoODGiS5g/hujVYorrr+uWzwCnV1/SK7Lloj EmnCPJfXP1Cu3TyuKjGLji9L9tWdNDlI= X-Received: by 2002:a05:6102:2421:: with SMTP id l1mr8887469vsi.16.1633206291534; Sat, 02 Oct 2021 13:24:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyXyOaAzbvPGMOnp1b1FkzO1eMJNQ68/s8G6qnIH676qjo6Tp64Gk7jKFW+QpHx52642RnfZAXsYT5gsDTGE3E= X-Received: by 2002:a05:6102:2421:: with SMTP id l1mr8887462vsi.16.1633206291254; Sat, 02 Oct 2021 13:24:51 -0700 (PDT) MIME-Version: 1.0 References: <57b54891-59ba-394d-3d53-218f5061b8ef@gmail.com> In-Reply-To: <57b54891-59ba-394d-3d53-218f5061b8ef@gmail.com> From: Jonathan Wakely Date: Sat, 2 Oct 2021 21:24:40 +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.8 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:24:56 -0000 On Sat, 2 Oct 2021 at 18:27, Fran=C3=A7ois Dumont wrote: > > I would like to propose this alternative approach. > > In this patch I make __normal_iterator and random iterator > _Safe_iterator compatible for pointer_traits primary template. > > Regarding pointer_traits I wonder if it shouldn't check for the > to_pointer method availability and use per default: return { > std::addressof(__e) }; otherwise. This way we wouldn't have to provide a > pointer_to method on __normal_iterator. But I would rather not have these members present in vector::iterator and string::iterator, in case users accidentally start to rely on them being present. Another option would be to overload std::__to_address so it knows how to get the address from __normal_iterator and _Safe_iterator.