From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by sourceware.org (Postfix) with ESMTPS id 20CCF3858CD1; Sat, 9 Dec 2023 13:04:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 20CCF3858CD1 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 20CCF3858CD1 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::42c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702127060; cv=none; b=keVSWZjgRMgrhSFanFhCQ6aGQPDQtu2Xur/BWEl1A58QWd16AGQ58RbZ4464jwGL1u0aflvVMWcZdP9qs40xYGVb1+9JSXUhOrtmhO2GgeyHrQ3An9L/ruSW/v7SiiVzvtUki8RLc/FsoSt6c+BmBdiB+uHRYrKSnv6xsEpjhrQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702127060; c=relaxed/simple; bh=O9z30BDE/YvgNn99aQkLyG1JNSbR/rkOuPdmVY7BRSM=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=o46qly5QSIbFzC5xtZaNrXn3EQQxzXtcPb5RWRlY+IpylMCxHwM2rcMPTp6IZcagADXcHTXIpDy7XbEZFwKwjJzPYf/QQeokVIZNLW05evFBZ65zpcSqJQf83Bi2QAMO4uePLni4XnsTXsOj6mmhLXgBF+6x+CRIl/9+Sjy0Oqw= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-3360ae1b937so1057299f8f.0; Sat, 09 Dec 2023 05:04:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702127055; x=1702731855; darn=gcc.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=jho4kSjZkJWgGMLGdOZk+DvFY2d1cFJpz1vz0ooiLKY=; b=YecTzMWwiqYXU7PtRXvKDP+DZ3N3t7qbR2Zo1P/I9e3Q5ucogMzFNZSUJ49N6mnlbu MB1pn/f6N7eeE+yW2jpq3jvZGsc7s5v+thudUNeRivPg0vap4NHOQiwVIhcLiq4AJXEF IFSAh0M7DPc82NFDJg4oK4lVpkzLUa3nSX4wMSjryXfgOZu0VgtL18UIKAYI1IU1hYEs jbc/IOs6oWtSdNIpJGlkI9Vt5vYBMuN0k5MSxiBsLQMNM1Y1tom+HgaYKNC+uZDLMuh3 TJepGu58+kH76TO16okN+z3q7EPeFwwH+Nn2CcfwxPXxipVSn0u+7jipJpJA88/x04xe YxeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702127055; x=1702731855; h=content-transfer-encoding:in-reply-to:from: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=jho4kSjZkJWgGMLGdOZk+DvFY2d1cFJpz1vz0ooiLKY=; b=LabmDdwRCJrE9nl8BwCjPzWASEREE9KWkrzECy1+sMNy8YpbxxnZVglikPVJ36+mYo mpOeDhSOjWv6/1hXRny0Kj7BtP52E9sxcMcwtDG6Tgf1cDplEIzGGd5CgqOHG2LxeGQt 4cR6yznUPLqld9HcwprCfN5Pu5FPvLlC57Ldss1uoBSYZ8W+j8CxvLXKYQuURd0JQK1r AHt0JAfxUGpIinURGRVW3iT504j2VbLj934hpOhLtZMSCBGCqUTMi0j5BFidlFK69fTn J/mM2ihA3WAeoyKKXSMplqeso564bVwAwDyR2A8WoZi3YcvgOdSBnMupln3rv11P3B5E /Ecw== X-Gm-Message-State: AOJu0YwBzTFfrGaS236xSmCQcMgbNLmb2UT0XXfZ7slSCSnJ8Tkf/MYx 8+ycDZvsx7lh5cyZyughn+A= X-Google-Smtp-Source: AGHT+IGh8wilCreJhzk8yJUcaJUqsmw8zKrlHaV8SQzIoZtOMZzO0X12cIGum4UCmVn24bSIaDSwFA== X-Received: by 2002:a5d:6212:0:b0:333:1cfc:27f6 with SMTP id y18-20020a5d6212000000b003331cfc27f6mr929641wru.30.1702127055344; Sat, 09 Dec 2023 05:04:15 -0800 (PST) Received: from ?IPV6:2a01:e0a:1dc:b1c0:30b1:c14b:9041:838e? ([2a01:e0a:1dc:b1c0:30b1:c14b:9041:838e]) by smtp.gmail.com with ESMTPSA id i6-20020a5d55c6000000b0033340aa3de2sm4320177wrw.14.2023.12.09.05.04.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 09 Dec 2023 05:04:14 -0800 (PST) Message-ID: <8ddcf55f-5941-4bc3-916a-2e26cc417b09@gmail.com> Date: Sat, 9 Dec 2023 14:04:14 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] Reimplement __gnu_cxx::__ops operators To: Jonathan Wakely Cc: libstdc++ , gcc-patches References: <6b960f74-7ef7-8c3f-20bd-3f5a19d1f449@gmail.com> <9c9d0f26-4ca9-4c1b-86fa-63bc65d21ecf@gmail.com> 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,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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 07/12/2023 14:41, Jonathan Wakely wrote: > On Wed, 6 Dec 2023 at 20:55, François Dumont wrote: >> I think I still got no feedback about this cleanup proposal. > Can you remind me why we have all those different functions in > predefined_ops.h in the first place? I think it was to avoid having > two versions of every algorithm, one that does *l < *r and one that > does pred(*l, *r), right? Yes, that was the purpose. > > One property of the current code is that _Iter_less_iter will compare > exactly *lhs < *rhs and so works even with this type, where its > operator< only accepts non-const arguments: > > struct X { bool operator<(X&); }; > > Doesn't your simplification break that, because the _Less function > only accepts const references now? Indeed, I thought more about the problem of const qualification on the operator(). This is why _Comp_val is mimicking what _Not_fn does. To be honnest I even thought that this kind of operator above was more a user code issue than a real use case we need to handle. But it looks like you, I guess the C++ Standard then, impose to support it. I'll rework it then, thanks for the proposal below and in your other email.