From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 85715 invoked by alias); 11 Sep 2017 12:11:09 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 84617 invoked by uid 89); 11 Sep 2017 12:11:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1433, thee, HX-Greylist:Mon, HContent-Transfer-Encoding:8bit X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 11 Sep 2017 12:11:04 +0000 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C7E435FD4C; Mon, 11 Sep 2017 12:11:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C7E435FD4C Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=jwakely@redhat.com Received: from localhost (unknown [10.33.36.109]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7AAB45C549; Mon, 11 Sep 2017 12:11:02 +0000 (UTC) Date: Mon, 11 Sep 2017 12:11:00 -0000 From: Jonathan Wakely To: Daniel =?iso-8859-1?Q?Kr=FCgler?= Cc: =?iso-8859-1?Q?Fran=E7ois?= Dumont , "libstdc++@gcc.gnu.org" , gcc-patches Subject: Re: std::forward_list optim for always equal allocator Message-ID: <20170911121101.GL4582@redhat.com> References: <20170908161940.GG4582@redhat.com> <45617be7-8df2-3e50-66de-81a71c3d5f62@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.8.3 (2017-05-23) X-SW-Source: 2017-09/txt/msg00570.txt.bz2 On 11/09/17 07:44 +0200, Daniel Krügler wrote: >2017-09-11 7:12 GMT+02:00 François Dumont : >> When user declare a container iterator like that: >> >> std::forward_list::iterator it; >> >> There is no reason to initialize it with a null node pointer. It is just an >> uninitialized iterator which is invalid to use except to initialize it. > >While that is correct, for every forward iterator (and >std::forward_list::iterator meets these requirements), it is also >required that a value-initialized iterator can be compared against >other initialized iterators, so this reduces the amount of freedom to >define a default constructor for such iterators even when used to >default-initialize. This is not meant as a showstopper argument, since >I have not fully understood of what you are planning, but just a >reminder. Right, which means that std::forward_list::iterator it = {}; must initialize the node pointer to nullptr. If we remove the initialization of _Fwd_list_iterator::_M_node from the default constructor then it would be left uninitialized. But I'm confused, François was talking about removing the initialization of _Fwd_list_node_base::_M_next, what has that got to do with forward_list::iterator? Thee is no node-base in the iterator. So I'm still wondering why the initialization of _M_next should be removed.