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 E04FA395CCD7 for ; Fri, 20 Nov 2020 10:23:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E04FA395CCD7 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-105-TfogOLDkNg6PBC4mhDEUgw-1; Fri, 20 Nov 2020 05:23:02 -0500 X-MC-Unique: TfogOLDkNg6PBC4mhDEUgw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CA1C41DDE7; Fri, 20 Nov 2020 10:23:00 +0000 (UTC) Received: from localhost (unknown [10.33.36.170]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6C2756085A; Fri, 20 Nov 2020 10:23:00 +0000 (UTC) Date: Fri, 20 Nov 2020 10:22:59 +0000 From: Jonathan Wakely To: =?iso-8859-1?Q?Fran=E7ois?= Dumont Cc: "libstdc++@gcc.gnu.org" , gcc-patches Subject: Re: [PATCH] Remove lambdas from _Rb_tree Message-ID: <20201120102259.GK1312820@redhat.com> References: <7c66cd1c-3f62-5f2c-fb75-2641d672a3d2@gmail.com> <20201117235031.GC503596@redhat.com> <20201119113127.GC1312820@redhat.com> <616cd512-76cd-5d7c-0a9b-7224816bc245@gmail.com> MIME-Version: 1.0 In-Reply-To: <616cd512-76cd-5d7c-0a9b-7224816bc245@gmail.com> X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00, BODY_8BITS, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Nov 2020 10:23:08 -0000 On 20/11/20 08:17 +0100, François Dumont via Libstdc++ wrote: >Here is what I am testing. > >I use your enum proposal as an alias for the bool type. I cannot use >it as template parameter on _M_copy unless I put it at std namespace >level to use it in definition of the outline _M_copy overload. You can do it as a member, but the syntax is ugly: template template::_CopyType _MoveValues, typename _NodeGen> typename _Rb_tree<_Key, _Val, _KoV, _Compare, _Alloc>::_Link_type _Rb_tree<_Key, _Val, _KoV, _Compare, _Alloc>:: _M_copy(_Link_type __x, _Base_ptr __p, _NodeGen& __node_gen) >I also added some tests checking correct usage of >__move_if_noexcept_cond. I prefer not to change this condition as >proposed in this patch. Yes, we can do that later if needed. >I wonder if I am right to check moved values in those tests ? Yes, I think that's good. >I also wonder after writing those tests if we shouldn't clear the >moved instance, especially when values are moved ? I remember seeing >some discussion about this but I don't know the conclusion. It's not required to clear them. Leaving them with moved-from values means the memory isn't deallocated, and those nodes can be reused if the container gets assigned new values. >    libstdc++: _Rb_tree code cleanup, remove lambdas > >    Use new template parameters to replace usage of lambdas to move or not >    tree values on copy. > >    libstdc++-v3/ChangeLog: > >            * include/bits/move.h (_GLIBCXX_FWDREF): New. >            * include/bits/stl_tree.h: Adapt to use latter. >            (_Rb_tree<>::_M_clone_node): Add _MoveValue template parameter. >            (_Rb_tree<>::_M_mbegin): New. >            (_Rb_tree<>::_M_begin): Use latter. >            (_Rb_tree<>::_M_copy): Add _MoveValues template parameter. >            * testsuite/23_containers/map/allocator/move_cons.cc: New test. >            * testsuite/23_containers/multimap/allocator/move_cons.cc: >New test. >            * testsuite/23_containers/multiset/allocator/move_cons.cc: >New test. >            * testsuite/23_containers/set/allocator/move_cons.cc: New test. > >Ok to commit once all tests have complete ? Yes, OK for trunk, thanks!