From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by sourceware.org (Postfix) with ESMTPS id 765673858C52; Sat, 4 Feb 2023 13:11:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 765673858C52 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-x335.google.com with SMTP id j29-20020a05600c1c1d00b003dc52fed235so5733641wms.1; Sat, 04 Feb 2023 05:11:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=AhvyWWhJ0SRFrZ1+vR7Cl6FQwNVTzYMY9t+G45yXZAY=; b=kSHBS60Y9qVF1pRgwWLKU6om5djr5bziRLgfo71m3hxQ8qozMSXh9XhYJtuyZpp6/f RnTxNLmN2fE5k9lmTGjCendj+uo7JWn0+KalfPjfDTf11Mvt/DzWYtjIF/NJwGqn2phB FYWEncj8G/OidYKr1EssmpIf+CL88SYbSpIYUXbTHFV+k94cLdgeRmoyB8rsBnHcGwzU qm6O2wwuHOPI/IDFgf0OvvnQ0ug95NyHx1ZDb3+tAuk2MkvslOzKu3gS7VnoTMcql76j mXXA7G33AdPL4aR5FM+GeH9Y4mttZE2XPLkkzaaFnX2swR2XRL1zzNEjH263h7aInJs0 lgSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=AhvyWWhJ0SRFrZ1+vR7Cl6FQwNVTzYMY9t+G45yXZAY=; b=qrThAPZBCXaPvfJ3JOLKv/KaKPpbgYoXPWSwPlN0/TnPKvXGyxm2meOfGCnRZ6c10s OdhFNnvYKQxcw1jouPt2Wd1jzRCAtzjW3QH3uLMX2SW6QJ4d3UPNcHQ6esfj8n3+Rh0x 2CraMPe2StN80a3975OQDPvPMLNy7M0QOZD0JteZE0qxciQdPFS2vfcMGjLnNcfK3YLb lIuCVs+oFLBCJuimiq/mDug72Pc5dT51KrydhwNuZhee8fCXHO87iyJug61OdlAtVDBX vKnCZEkN2WSvvbsZi4X401RdadmD3nZivhc7fX8CJPKXQGi9YI+dqNKmePzzwAEomPOV MyuQ== X-Gm-Message-State: AO0yUKWw5i3m8zQrzdrA4rRfivp8fueIFqIHeFvWNpOvJ5CqqzfQzmhg g5zo+R18zdOj5fGqhP3b+Jg= X-Google-Smtp-Source: AK7set/kpmk7sTxO/oAQFjxCTqAjJAwkLoUOX3kq/Ti4NpwlcD2NHQ2tw23ofpK+6G9uZ+RleWke6A== X-Received: by 2002:a7b:c8c6:0:b0:3df:9858:c03b with SMTP id f6-20020a7bc8c6000000b003df9858c03bmr6860895wml.16.1675516288809; Sat, 04 Feb 2023 05:11:28 -0800 (PST) Received: from ?IPV6:2a01:e0a:1dc:b1c0:10b4:d0dd:f551:c7ff? ([2a01:e0a:1dc:b1c0:10b4:d0dd:f551:c7ff]) by smtp.googlemail.com with ESMTPSA id c3-20020a05600c0ac300b003db012d49b7sm13878762wmr.2.2023.02.04.05.11.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 04 Feb 2023 05:11:28 -0800 (PST) Message-ID: <9f3648a8-0cbd-4fe8-1a9d-1902d9ab415c@gmail.com> Date: Sat, 4 Feb 2023 14:11:27 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH] minor optimization bug in basic_string move assignment To: Jonathan Wakely Cc: "libstdc++@gcc.gnu.org" , waffl3x , gcc-patches References: <52e5d904-da8a-14f1-6704-53f89dbd2d69@gmail.com> Content-Language: fr From: =?UTF-8?Q?Fran=c3=a7ois_Dumont?= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 03/02/23 15:50, Jonathan Wakely wrote: > On Wed, 25 Jan 2023 at 18:38, François Dumont wrote: >> Let's submit a proper patch proposal then. >> >> The occasion for me to ask if there is any reason for cow string not >> being C++11 allocator compliant ? Just lack of interest ? > Mostly lack of interest, but also I don't really want to "encourage" > the use of the old string by investing lots of maintenance effort into > it. If you want new features like C++11 Allocators and > resize_and_overwrite etc then you should use the new type. > > I don't remember if there were any actual blockers that made it > difficult to support stateful allocators in the COW string. I might > have written something about it in mails to the list when I was adding > the SSO string, but I don't remember now. Ok, thanks for feedback. I won't bother then. > > Anyway, for this patch ... > >> I wanted to consider it to get rid of the __gnu_debug::_Safe_container >> _IsCxx11AllocatorAware template parameter. >> >> libstdc++: Optimize basic_string move assignment >> >> Since resolution of Issue 2593 [1] we can consider that equal >> allocators >> before the propagate-on-move-assignment operations will still be equal >> afterward. >> >> So we can extend the optimization of transfering the storage of the >> move-to >> instance to the move-from one that is currently limited to always equal >> allocators. >> >> [1] https://cplusplus.github.io/LWG/issue2593 >> >> libstdc++-v3/ChangeLog: >> >> * include/bits/basic_string.h (operator=(basic_string&&)): >> Transfer move-to >> storage to the move-from instance when allocators are equal. >> * >> testsuite/21_strings/basic_string/allocator/char/move_assign.cc (test04): >> New test case. >> >> Tested under linux x86_64, ok to commit ? > OK for trunk, thanks! > > +Reviewed-by: Jonathan Wakely Should I have added this to the commit ? If so sorry, I haven't.