220 7201 <CAOpASk4=zJ8Gwq9aGXaCww0PkcnjbjCa2GhPVdTY3W3++N9tww@mail.gmail.com> article
Path: news.gmane.org!not-for-mail
From: =?ISO-8859-1?Q?R=E9my_Lefevre?= <lefevreremy@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: "count_while" and "count_until" algorithms
Date: Wed, 9 Oct 2013 00:35:47 +0200
Lines: 248
Approved: news@gmane.org
Message-ID: <CAOpASk4=zJ8Gwq9aGXaCww0PkcnjbjCa2GhPVdTY3W3++N9tww@mail.gmail.com>
References: <CAOpASk64dV+3ZUW+Z8wcEqug_oSaztvJp1zsDB_QdAxi+fwcsA@mail.gmail.com>
 <fe7981d7-4eaf-4132-9150-4ec7d3ff7ac4@isocpp.org> <2602b3fd-fccd-459b-be1a-93a12005dc5c@isocpp.org>
 <231e6ef1-599d-4877-be6c-55e85e5a4e41@isocpp.org> <6e15fc38-8be3-4e74-ade9-e25a8d0e0509@isocpp.org>
 <2d16db0e-fb46-4e1f-956f-db3407a6fb4c@isocpp.org> <1381268094.9101.48.camel@sara>
 <CAOpASk7V=1N=BJgrSki2sqbYwOUD2puZCh7RQ_DkkvZJA_2Z5A@mail.gmail.com> <2946a4c1-2cdc-4c31-ad1b-bef0ce40873b@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary=089e011779b541f3d504e8426606
X-Trace: ger.gmane.org 1381271789 15076 80.91.229.3 (8 Oct 2013 22:36:29 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Tue, 8 Oct 2013 22:36:29 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCN7B34JVEARB3ER2KJAKGQEZB6UDQQ@isocpp.org Wed Oct 09 00:36:31 2013
Return-path: <std-proposals+bncBCN7B34JVEARB3ER2KJAKGQEZB6UDQQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-lb0-f197.google.com ([209.85.217.197])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCN7B34JVEARB3ER2KJAKGQEZB6UDQQ@isocpp.org>)
	id 1VTftG-0000Lf-71
	for gclcip-std-proposals@m.gmane.org; Wed, 09 Oct 2013 00:36:30 +0200
Original-Received: by mail-lb0-f197.google.com with SMTP id w6sf123233lbh.8
        for <gclcip-std-proposals@m.gmane.org>; Tue, 08 Oct 2013 15:36:29 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=mime-version:in-reply-to:references:from:date:message-id:subject:to
         :x-original-sender:x-original-authentication-results:reply-to
         :precedence:mailing-list:list-id:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe:content-type;
        bh=P5upKeeTXU117CQ32wsr2xUfDxYn+d9VwZ4CcmcGOzQ=;
        b=Id3wCZOyQNqSsPY0DMCsrN4CSQV8oYM5Q4/bfaI4g7NfJ0u9B3i0NleJu3Sid0aYeq
         k/F5xTNdxHPd/U2HCJzGGGFPXxo6bagkpSZerKyNpwJljtSi4puOsNlI21sA3g9F0GNM
         m6TqgMSR6hdnsAiadXk+r8E3gKM0nfBu3i9tTabIZGeB+mNesitkn8EPkYeSaR27lduT
         1NRceyxfFmzwSG4wSorYhTxMz2g9/sXe2kCY0nl2hm0p1U1pWCrq7lL07hEHKxFsmpXt
         26IyWYIbrZai/IucmElTCti4CewVG2CvIwoD4wQUA1q47Ao381o2+gigM5kjJVyJC3KM
         5VOg==
X-Received: by 10.180.189.137 with SMTP id gi9mr1615003wic.1.1381271789351;
        Tue, 08 Oct 2013 15:36:29 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.180.189.98 with SMTP id gh2ls281814wic.37.gmail; Tue, 08 Oct
 2013 15:36:28 -0700 (PDT)
X-Received: by 10.194.94.167 with SMTP id dd7mr3855857wjb.43.1381271788149;
        Tue, 08 Oct 2013 15:36:28 -0700 (PDT)
Original-Received: from mail-wg0-x230.google.com (mail-wg0-x230.google.com [2a00:1450:400c:c00::230])
        by mx.google.com with ESMTPS id x3si14696934wje.78.1969.12.31.16.00.00
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Tue, 08 Oct 2013 15:36:28 -0700 (PDT)
Received-SPF: pass (google.com: domain of lefevreremy@gmail.com designates 2a00:1450:400c:c00::230 as permitted sender) client-ip=2a00:1450:400c:c00::230;
Original-Received: by mail-wg0-f48.google.com with SMTP id b13so1305721wgh.3
        for <std-proposals@isocpp.org>; Tue, 08 Oct 2013 15:36:28 -0700 (PDT)
X-Received: by 10.194.122.99 with SMTP id lr3mr3764553wjb.21.1381271787924;
 Tue, 08 Oct 2013 15:36:27 -0700 (PDT)
Original-Received: by 10.194.192.33 with HTTP; Tue, 8 Oct 2013 15:35:47 -0700 (PDT)
In-Reply-To: <2946a4c1-2cdc-4c31-ad1b-bef0ce40873b@isocpp.org>
X-Original-Sender: lefevreremy@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of lefevreremy@gmail.com designates 2a00:1450:400c:c00::230 as
 permitted sender) smtp.mail=lefevreremy@gmail.com;       dkim=pass
 header.i=@gmail.com;       dmarc=pass (p=NONE dis=NONE) header.from=gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Google-Group-Id: 399137483710
List-Post: <http://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:7201
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/7201>

--089e011779b541f3d504e8426606
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

I agree one algorithm could be enough. But it should be more convenient to
have both of them. C++11 added for example find_if_not that is exactly
find_if + not1.

For the name, as pointed out by Evgeny, "_if" has another semantic, that is
to pass through the entire range and perform action only when a predicate
is true (except for find_if). Instead, "_while" and "_until" should perform
a action while and until a predicate is true, respectively. There is
already is_heap_until using this kind of suffix.


2013/10/9 Vlad from Moscow <vlad.moscow@mail.ru>

> As I pointed already I think that it would be enough to have only one
> algorithm because you always can get the negation of a predicate at least
> using lambda expressions.
>
> As for the name then it should be consistent with names of similar by
> logic algorithms.
>
> "if" in the name points out that a predicate is used. At present it is a
> general approach of naming algorithms with a predicate in the C++ Standar=
d.
>
> =D1=81=D1=80=D0=B5=D0=B4=D0=B0, 9 =D0=BE=D0=BA=D1=82=D1=8F=D0=B1=D1=80=D1=
=8F 2013 =D0=B3., 1:59:05 UTC+4 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=
=D0=B0=D1=82=D0=B5=D0=BB=D1=8C R=C3=A9my Lefevre =D0=BD=D0=B0=D0=BF=D0=B8=
=D1=81=D0=B0=D0=BB:
>
>> I agree with Evgeny for the use of "while" and "until" instead of
>> "first_if". I think they are more intuitive and make more sense.
>>
>> Concerning the return_type, it's true that std::pair is already used for
>> several component in the library and the algorithm shouldn't throw away =
a
>> useful information like the first not counted iterator.
>>
>>
>> 2013/10/8 Magnus Fromreide <ma...@lysator.liu.se>
>>
>>>  On Tue, 2013-10-08 at 13:56 -0700, Vlad from Moscow wrote:
>>> > I want to change the name in the context of my proposal of
>>> > std::accumulate_first_if that there will be a common name for such
>>> > types of algorithms.
>>> >
>>> > By the way using std::find_if with a predicate resolves the two tasks=
:
>>> > returning the count and the last iterator.
>>>
>>> If we should change the names then I think the best name would be
>>>
>>> distance_first_if
>>>
>>> since it is about the distance from one point to another in a range, an=
d
>>> the end point is defined as the first entry matching a predicate.
>>>
>>> (I also think the bikeshed should be pink)
>>>
>>> /MF
>>>
>>> --
>>>
>>> ---
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "ISO C++ Standard - Future Proposals" group.
>>> To unsubscribe from this topic, visit https://groups.google.com/a/**
>>> isocpp.org/d/topic/std-**proposals/bXrQrkBw59c/**unsubscribe<https://gr=
oups.google.com/a/isocpp.org/d/topic/std-proposals/bXrQrkBw59c/unsubscribe>
>>> .
>>>  To unsubscribe from this group and all its topics, send an email to
>>> std-proposal...@**isocpp.org.
>>> To post to this group, send email to std-pr...@isocpp.org.
>>>
>>> Visit this group at http://groups.google.com/a/**isocpp.org/group/std-*=
*
>>> proposals/ <http://groups.google.com/a/isocpp.org/group/std-proposals/>=
..
>>>
>>
>>  --
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/a/isocpp.org/d/topic/std-proposals/bXrQrkBw59c/=
unsubscribe
> .
> To unsubscribe from this group and all its topics, send an email to
> std-proposals+unsubscribe@isocpp.org.
> To post to this group, send email to std-proposals@isocpp.org.
> Visit this group at
> http://groups.google.com/a/isocpp.org/group/std-proposals/.
>

--=20

---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

--089e011779b541f3d504e8426606
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">I agree one algorithm could be enough. But it should be mo=
re convenient to have both of them. C++11 added for example find_if_not tha=
t is exactly find_if + not1.<br><div><br>For the name, as pointed out by Ev=
geny, &quot;_if&quot; has another semantic, that is to pass through the ent=
ire range and perform action only when a predicate is true (except for find=
_if). Instead, &quot;_while&quot; and &quot;_until&quot; should perform a a=
ction while and until a predicate is true, respectively. There is already i=
s_heap_until using this kind of suffix. <br>

</div></div><div class=3D"gmail_extra"><br><br><div class=3D"gmail_quote">2=
013/10/9 Vlad from Moscow <span dir=3D"ltr">&lt;<a href=3D"mailto:vlad.mosc=
ow@mail.ru" target=3D"_blank">vlad.moscow@mail.ru</a>&gt;</span><br><blockq=
uote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc =
solid;padding-left:1ex">

<div dir=3D"ltr"><div>As I pointed already I think that it=C2=A0would be=C2=
=A0enough to have only one algorithm because you always can get=C2=A0the ne=
gation of a predicate at least using lambda expressions.</div><div>=C2=A0</=
div><div>As for the name then it should be consistent=C2=A0with names of si=
milar by logic algorithms.</div>

<div>=C2=A0</div><div>&quot;if&quot; in the name points out=C2=A0that a pre=
dicate is used. At present it is a general approach of naming algorithms wi=
th a predicate in the C++ Standard.</div><div><br>=D1=81=D1=80=D0=B5=D0=B4=
=D0=B0, 9 =D0=BE=D0=BA=D1=82=D1=8F=D0=B1=D1=80=D1=8F 2013=C2=A0=D0=B3., 1:5=
9:05 UTC+4 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=
=BB=D1=8C R=C3=A9my Lefevre =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:</di=
v>

<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;padding=
-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-l=
eft-style:solid"><div class=3D"im"><div dir=3D"ltr"><div><div>I agree with =
Evgeny for the use of &quot;while&quot; and &quot;until&quot; instead of &q=
uot;first_if&quot;. I think they are more intuitive and make more sense.<br=
>

<br></div>Concerning the return_type, it&#39;s true that std::pair is alrea=
dy used for several component in the library and the algorithm shouldn&#39;=
t throw away a useful information like the first not counted iterator.<br>



</div></div></div><div><br><br><div class=3D"gmail_quote">2013/10/8 Magnus =
Fromreide <span dir=3D"ltr">&lt;<a>ma...@lysator.liu.se</a>&gt;</span><br><=
blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;padding-=
left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-le=
ft-style:solid">

<div class=3D"im">

<div>On Tue, 2013-10-08 at 13:56 -0700, Vlad from Moscow wrote:<br>
&gt; I want to change the name in the context of my proposal of<br>
&gt; std::accumulate_first_if that there will be a common name for such<br>
&gt; types of algorithms.<br>
&gt;<br>
&gt; By the way using std::find_if with a predicate resolves the two tasks:=
<br>
&gt; returning the count and the last iterator.<br>
<br>
</div>If we should change the names then I think the best name would be<br>
<br>
distance_first_if<br>
<br>
since it is about the distance from one point to another in a range, and<br=
>
the end point is defined as the first entry matching a predicate.<br>
<br>
(I also think the bikeshed should be pink)<br>
<span><font color=3D"#888888"><br>
/MF<br>
</font></span></div><div><div><div class=3D"im"><br>
--<br>
<br>
---<br>
You received this message because you are subscribed to a topic in the Goog=
le Groups &quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this topic, visit <a href=3D"https://groups.google.com/=
a/isocpp.org/d/topic/std-proposals/bXrQrkBw59c/unsubscribe" target=3D"_blan=
k">https://groups.google.com/a/<u></u>isocpp.org/d/topic/std-<u></u>proposa=
ls/bXrQrkBw59c/<u></u>unsubscribe</a>.<br>

</div>


To unsubscribe from this group and all its topics, send an email to <a>std-=
proposal...@<u></u>isocpp.org</a>.<br>
To post to this group, send email to <a>std-pr...@isocpp.org</a>.<div class=
=3D"im"><br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">http://groups.google.com/a/<u></u>isocpp.=
org/group/std-<u></u>proposals/</a>.<br>
</div></div></div></blockquote></div><br></div>
</blockquote></div><div class=3D"HOEnZb"><div class=3D"h5">

<p></p>

-- <br>
=C2=A0<br>
--- <br>
You received this message because you are subscribed to a topic in the Goog=
le Groups &quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this topic, visit <a href=3D"https://groups.google.com/=
a/isocpp.org/d/topic/std-proposals/bXrQrkBw59c/unsubscribe" target=3D"_blan=
k">https://groups.google.com/a/isocpp.org/d/topic/std-proposals/bXrQrkBw59c=
/unsubscribe</a>.<br>


To unsubscribe from this group and all its topics, send an email to <a href=
=3D"mailto:std-proposals%2Bunsubscribe@isocpp.org" target=3D"_blank">std-pr=
oposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">http://groups.google.com/a/isocpp.org/gro=
up/std-proposals/</a>.<br>
</div></div></blockquote></div><br></div>

<p></p>

-- <br />
&nbsp;<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--089e011779b541f3d504e8426606--

.
