220 7229 <CAPBZbvwozTe2mj4icFZkf6PC4CjRuPsf9jL36DfLQrJ-F3YQfA@mail.gmail.com> article
Path: news.gmane.org!not-for-mail
From: "Billy O'Neal" <billy.oneal@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: "count_while" and "count_until" algorithms
Date: Wed, 9 Oct 2013 07:07:25 -0700
Lines: 601
Approved: news@gmane.org
Message-ID: <CAPBZbvwozTe2mj4icFZkf6PC4CjRuPsf9jL36DfLQrJ-F3YQfA@mail.gmail.com>
References: <CAOpASk64dV+3ZUW+Z8wcEqug_oSaztvJp1zsDB_QdAxi+fwcsA@mail.gmail.com>
 <a25301a7-e4c6-4245-b053-00d46ca5c7d4@isocpp.org> <AEDAD631-3D32-421B-85CA-9C342D57A439@hsr.ch>
 <CAOpASk4SNY8aQJ8ijO7xNjBtTvLncHySJ9kWeyPyF+n3=zFtiA@mail.gmail.com> <CAOpASk6YqoDO5VU-QuKEg4ijMcwAfRT4OFQd-MhJFXehie-6Dw@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary=047d7bd76d1e24bcec04e84f6afc
X-Trace: ger.gmane.org 1381327690 16669 80.91.229.3 (9 Oct 2013 14:08:10 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Wed, 9 Oct 2013 14:08:10 +0000 (UTC)
To: std-proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBDKLBLVE6ADBBSOG2WJAKGQEOVFFF7I@isocpp.org Wed Oct 09 16:08:16 2013
Return-path: <std-proposals+bncBDKLBLVE6ADBBSOG2WJAKGQEOVFFF7I@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ie0-f200.google.com ([209.85.223.200])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDKLBLVE6ADBBSOG2WJAKGQEOVFFF7I@isocpp.org>)
	id 1VTuQw-0000kn-KB
	for gclcip-std-proposals@m.gmane.org; Wed, 09 Oct 2013 16:08:15 +0200
Original-Received: by mail-ie0-f200.google.com with SMTP id tp5sf3537945ieb.7
        for <gclcip-std-proposals@m.gmane.org>; Wed, 09 Oct 2013 07:08:10 -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=/xfKgGyuAHogFlOOiD6CSfANvBxpqXk/br9t6HmDA6E=;
        b=FjG/NoVZEs6X398g8kypJsAQfehJjX+KtP4dUdGQXOB6gito1Ua9bmut64VQpIFCKE
         tJkP8EapcxYEqj2+Q3zAdiTet4QmKpwL3k1nmI8m5+WiSa6ZxYkXXOC9ot8TYyhp9jbu
         ziJa7I2/T10NK51g5NOf60MjTr2MDrh7zpWDwjlTEzvbxbmZ6jcWoufDcaavXJA6rTys
         C/SoMn7msXur/1o46656B8lIEir5eVV+6z3btqCp4Bb9ujKXX5uw/o95Coq0iB4pz0A4
         i/VsmzRaExK3DuHrAPyortAKxZ4y/sCaNKboWUBi60FSvBi6Kmr97hdBVYGvw2xNKq8K
         5iyw==
X-Received: by 10.182.19.133 with SMTP id f5mr1565748obe.36.1381327690020;
        Wed, 09 Oct 2013 07:08:10 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.182.42.195 with SMTP id q3ls140887obl.71.gmail; Wed, 09 Oct
 2013 07:08:09 -0700 (PDT)
X-Received: by 10.182.114.231 with SMTP id jj7mr5992674obb.33.1381327689388;
        Wed, 09 Oct 2013 07:08:09 -0700 (PDT)
Original-Received: from mail-ie0-x22f.google.com (mail-ie0-x22f.google.com [2607:f8b0:4001:c03::22f])
        by mx.google.com with ESMTPS id pu10si4295187obb.152.1969.12.31.16.00.00
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Wed, 09 Oct 2013 07:08:09 -0700 (PDT)
Received-SPF: pass (google.com: domain of billy.oneal@gmail.com designates 2607:f8b0:4001:c03::22f as permitted sender) client-ip=2607:f8b0:4001:c03::22f;
Original-Received: by mail-ie0-f175.google.com with SMTP id aq17so1493270iec.20
        for <std-proposals@isocpp.org>; Wed, 09 Oct 2013 07:08:07 -0700 (PDT)
X-Received: by 10.50.154.66 with SMTP id vm2mr2061507igb.57.1381327687691;
 Wed, 09 Oct 2013 07:08:07 -0700 (PDT)
Original-Received: by 10.43.166.67 with HTTP; Wed, 9 Oct 2013 07:07:25 -0700 (PDT)
In-Reply-To: <CAOpASk6YqoDO5VU-QuKEg4ijMcwAfRT4OFQd-MhJFXehie-6Dw@mail.gmail.com>
X-Original-Sender: billy.oneal@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of billy.oneal@gmail.com designates 2607:f8b0:4001:c03::22f as
 permitted sender) smtp.mail=billy.oneal@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:7229
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/7229>

--047d7bd76d1e24bcec04e84f6afc
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

On the other hand, it is typically trivial to initialize "last" with the
count of the container to which it points. (Depending on the container)

Billy O'Neal
https://github.com/BillyONeal/ <https://bitbucket.org/BillyONeal/>
http://stackoverflow.com/users/82320/billy-oneal
Malware Response Instructor - BleepingComputer.com


On Wed, Oct 9, 2013 at 4:13 AM, R=E9my Lefevre <lefevreremy@gmail.com> wrot=
e:

> Furthermore, the counting_iterator doesn't always work. For example, if
> find/find_if reaches the end of the range, the behavior is to return the
> iterator named "last" passed in argument. But this iterator has not been
> incremented by the algorithm and its counter is set to 0 instead of the
> distance between first and last, leading to a wrong result.
>
>
> 2013/10/9 R=E9my Lefevre <lefevreremy@gmail.com>
>
>> Good point for a counting iterator ! Unfortunately, the one in boost
>> library doesn't fit our need here and I am not aware of any counting
>> iterator in C++14.
>>
>>
>> 2013/10/9 Peter Sommerlad <Peter.Sommerlad@hsr.ch>
>>
>>> +1 for composability instead of proliferation...
>>>
>>> Do we have boost's counting iterator adapter in c++14 or library TS?
>>>
>>> Sent from Peter Sommerlad's iPad
>>>
>>> On 09.10.2013, at 07:13, "Benjamin Lindley" <benjameslindley@gmail.com>
>>> wrote:
>>>
>>> What about creating an iterator adapter instead?  One which keeps track
>>> of how many times it has been incremented?
>>>
>>> typedef std::istream_iterator<int> base_t;
>>> base_t ib(std::cin), ie;
>>> std::counting_iterator<base_t> b(ib), e(ie);
>>> auto p =3D std::find_if(b, e, pred);
>>> std::cout << p.count();
>>>
>>> Then you could apply it to other algorithms besides find/find_if.
>>>
>>> On Tuesday, October 8, 2013 3:04:23 PM UTC-5, R=E9my Lefevre wrote:
>>>>
>>>> Hi,
>>>>
>>>> I thought about two new algorithms, that could be named "count_while"
>>>> and "count_until". Here are their behavior:
>>>>
>>>> template <class InputIterator, class UnaryPredicate>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>   typename iterator_traits<InputIterator>**::difference_type
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>     count_while (InputIterator first, InputIterator last, UnaryPredica=
te pred)
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> {
>>>>   typename iterator_traits<InputIterator>**::difference_type ret =3D 0=
;
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>   while (first!=3Dlast && pred(*first)) {
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>     ++ret;
>>>>     ++first;
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>   }
>>>>   return ret;
>>>>
>>>> }
>>>>
>>>>
>>>> template <class InputIterator, class UnaryPredicate>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>   typename iterator_traits<InputIterator>**::difference_type
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>     count_until (InputIterator first, InputIterator last, UnaryPredica=
te pred)
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> {
>>>>
>>>>   typename iterator_traits<InputIterator>**::difference_type ret =3D 0=
;
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>   while (first!=3Dlast && !pred(*first)) {
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>     ++ret;
>>>>     ++first;
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>   }
>>>>   return ret;
>>>>
>>>>
>>>> }
>>>>
>>>>
>>>> What do you think about adding these two components to the algorithms
>>>> library ?
>>>>
>>>  --
>>>
>>> ---
>>> 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 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/.
>>>
>>>  --
>>>
>>> ---
>>> 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/bXrQrkBw59=
c/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/.
>>>
>>
>>
>  --
>
> ---
> 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
> 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/.

--047d7bd76d1e24bcec04e84f6afc
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On the other hand, it is typically trivial to initialize &=
quot;last&quot; with the count of the container to which it points. (Depend=
ing on the container)</div><div class=3D"gmail_extra"><br clear=3D"all"><di=
v><div dir=3D"ltr">

<div>Billy O&#39;Neal</div><div><a href=3D"https://bitbucket.org/BillyONeal=
/" target=3D"_blank">https://github.com/BillyONeal/</a></div><div><a href=
=3D"http://stackoverflow.com/users/82320/billy-oneal" target=3D"_blank">htt=
p://stackoverflow.com/users/82320/billy-oneal</a></div>

<div>Malware Response Instructor - BleepingComputer.com</div></div></div>
<br><br><div class=3D"gmail_quote">On Wed, Oct 9, 2013 at 4:13 AM, R=E9my L=
efevre <span dir=3D"ltr">&lt;<a href=3D"mailto:lefevreremy@gmail.com" targe=
t=3D"_blank">lefevreremy@gmail.com</a>&gt;</span> wrote:<br><blockquote cla=
ss=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;pa=
dding-left:1ex">

<div dir=3D"ltr">Furthermore, the counting_iterator doesn&#39;t always work=
.. For example, if find/find_if reaches the end of the range, the behavior i=
s to return the iterator named &quot;last&quot; passed in argument. But thi=
s iterator has not been incremented by the algorithm and its counter is set=
 to 0 instead of the distance between first and last, leading to a wrong re=
sult.<br>



</div><div class=3D"HOEnZb"><div class=3D"h5"><div class=3D"gmail_extra"><b=
r><br><div class=3D"gmail_quote">2013/10/9 R=E9my Lefevre <span dir=3D"ltr"=
>&lt;<a href=3D"mailto:lefevreremy@gmail.com" target=3D"_blank">lefevreremy=
@gmail.com</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-l=
eft-style:solid">

<div dir=3D"ltr">Good point for a counting iterator ! Unfortunately, the on=
e in boost library doesn&#39;t fit our need here and I am not aware of any =
counting iterator in C++14.<br></div><div><div>

<div class=3D"gmail_extra"><br><br><div class=3D"gmail_quote">
2013/10/9 Peter Sommerlad <span dir=3D"ltr">&lt;<a href=3D"mailto:Peter.Som=
merlad@hsr.ch" target=3D"_blank">Peter.Sommerlad@hsr.ch</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 dir=3D"auto"><div>+1 for composability instead of proliferation...</di=
v><div><br></div><div>Do we have boost&#39;s counting iterator adapter in c=
++14 or library TS?<br><br>Sent from Peter Sommerlad&#39;s<span>=A0iPad</sp=
an></div>




<div><div><div><br>On 09.10.2013, at 07:13, &quot;Benjamin Lindley&quot; &l=
t;<a href=3D"mailto:benjameslindley@gmail.com" target=3D"_blank">benjamesli=
ndley@gmail.com</a>&gt; wrote:<br><br></div></div></div><blockquote type=3D=
"cite">




<div><div><div><div dir=3D"ltr">What about creating an iterator adapter ins=
tead?=A0 One which keeps track of how many times it has been incremented?<b=
r><br><div style=3D"border:1px solid rgb(187,187,187);background-color:rgb(=
250,250,250)">




<code><div><span style=3D"color:rgb(0,0,136)">typedef</span><span> std</spa=
n><span style=3D"color:rgb(102,102,0)">::</span><span>istream_iterator</spa=
n><span style=3D"color:rgb(0,136,0)">&lt;int&gt;</span><span> base_t</span>=
<span style=3D"color:rgb(102,102,0)">;</span><span><br>




base_t ib</span><span style=3D"color:rgb(102,102,0)">(</span><span>std</spa=
n><span style=3D"color:rgb(102,102,0)">::</span><span>cin</span><span style=
=3D"color:rgb(102,102,0)">),</span><span> ie</span><span style=3D"color:rgb=
(102,102,0)">;</span><span><br>


std</span><span style=3D"color:rgb(102,102,0)">::</span><span>counting_iter=
ator</span><span style=3D"color:rgb(0,136,0)">&lt;base_t&gt;</span><span> b=
</span><span style=3D"color:rgb(102,102,0)">(</span><span>ib</span><span st=
yle=3D"color:rgb(102,102,0)">),</span><span> e</span><span style=3D"color:r=
gb(102,102,0)">(</span><span>ie</span><span style=3D"color:rgb(102,102,0)">=
);</span><span><br>




</span><span style=3D"color:rgb(0,0,136)">auto</span><span> p </span><span =
style=3D"color:rgb(102,102,0)">=3D</span><span> std</span><span style=3D"co=
lor:rgb(102,102,0)">::</span><span>find_if</span><span style=3D"color:rgb(1=
02,102,0)">(</span><span>b</span><span style=3D"color:rgb(102,102,0)">,</sp=
an><span> e</span><span style=3D"color:rgb(102,102,0)">,</span><span> pred<=
/span><span style=3D"color:rgb(102,102,0)">);</span><span><br>




std</span><span style=3D"color:rgb(102,102,0)">::</span><span>cout </span><=
span style=3D"color:rgb(102,102,0)">&lt;&lt;</span><span> p</span><span sty=
le=3D"color:rgb(102,102,0)">.</span><span>count</span><span style=3D"color:=
rgb(102,102,0)">();</span><span><br>


</span></div></code></div><br>Then you could apply it to other algorithms b=
esides find/find_if.<br><br>On Tuesday, October 8, 2013 3:04:23 PM UTC-5, R=
=E9my Lefevre wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0px 0=
px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-lef=
t-width:1px;border-left-style:solid">




<div dir=3D"ltr">Hi,<br><br>I thought about two new algorithms, that could =
be named &quot;count_while&quot; and &quot;count_until&quot;. Here are thei=
r behavior:<br><br><div style=3D"border:1px solid rgb(187,187,187);backgrou=
nd-color:rgb(250,250,250)">






<code><div><pre><code><var><span style=3D"color:rgb(0,0,136)">template</spa=
n></var><span> </span><span style=3D"color:rgb(102,102,0)">&lt;</span><var>=
<span style=3D"color:rgb(0,0,136)">class</span></var><span> </span><span st=
yle=3D"color:rgb(102,0,102)">InputIterator</span><span style=3D"color:rgb(1=
02,102,0)">,</span><span> </span><var><span style=3D"color:rgb(0,0,136)">cl=
ass</span></var><span> </span><span style=3D"color:rgb(102,0,102)">UnaryPre=
dicate</span><span style=3D"color:rgb(102,102,0)">&gt;</span><span><br>






=A0 </span><var><span style=3D"color:rgb(0,0,136)">typename</span></var><sp=
an> iterator_traits</span><span style=3D"color:rgb(102,102,0)">&lt;</span><=
span style=3D"color:rgb(102,0,102)">InputIterator</span><span style=3D"colo=
r:rgb(102,102,0)">&gt;<u></u>::</span><span>difference_type<br>






=A0 =A0 count_while </span><span style=3D"color:rgb(102,102,0)">(</span><sp=
an style=3D"color:rgb(102,0,102)">InputIterator</span><span> first</span><s=
pan style=3D"color:rgb(102,102,0)">,</span><span> </span><span style=3D"col=
or:rgb(102,0,102)">InputIterator</span><span> </span><span style=3D"color:r=
gb(0,0,136)">last</span><span style=3D"color:rgb(102,102,0)">,</span><span>=
 </span><span style=3D"color:rgb(102,0,102)">UnaryPredicate</span><span> pr=
ed</span><span style=3D"color:rgb(102,102,0)">)</span><span><br>






</span><span style=3D"color:rgb(102,102,0)">{</span><span><br>=A0 </span><v=
ar><span style=3D"color:rgb(0,0,136)">typename</span></var><span> iterator_=
traits</span><span style=3D"color:rgb(102,102,0)">&lt;</span><span style=3D=
"color:rgb(102,0,102)">InputIterator</span><span style=3D"color:rgb(102,102=
,0)">&gt;<u></u>::</span><span>difference_type ret </span><span style=3D"co=
lor:rgb(102,102,0)">=3D</span><span> </span><span style=3D"color:rgb(0,102,=
102)">0</span><span style=3D"color:rgb(102,102,0)">;</span><span><br>






=A0 </span><var><span style=3D"color:rgb(0,0,136)">while</span></var><span>=
 </span><span style=3D"color:rgb(102,102,0)">(</span><span>first</span><spa=
n style=3D"color:rgb(102,102,0)">!=3D</span><span style=3D"color:rgb(0,0,13=
6)">last</span><var><span> </span><span style=3D"color:rgb(102,102,0)">&amp=
;&amp;</span><span> </span></var><var></var><span>pred</span><span style=3D=
"color:rgb(102,102,0)">(*</span><span>first</span><span style=3D"color:rgb(=
102,102,0)">))</span><span> </span><span style=3D"color:rgb(102,102,0)">{</=
span><span><br>






=A0 =A0 </span><span style=3D"color:rgb(102,102,0)">++</span><span>ret</spa=
n><span style=3D"color:rgb(102,102,0)">;</span><span><br>=A0 =A0 </span><sp=
an style=3D"color:rgb(102,102,0)">++</span><span>first</span><span style=3D=
"color:rgb(102,102,0)">;</span><span><br>






=A0 </span><span style=3D"color:rgb(102,102,0)">}</span><span><br>=A0 </spa=
n><var><span style=3D"color:rgb(0,0,136)">return</span></var><span> ret</sp=
an><span style=3D"color:rgb(102,102,0)">;</span><span><br>

</span><span style=3D"color:rgb(102,102,0)">}</span></code></pre></div></co=
de></div><br><div style=3D"border:1px solid rgb(187,187,187);background-col=
or:rgb(250,250,250)">




<code><div><pre><code><var><span style=3D"color:rgb(0,0,136)">template</spa=
n></var><span> </span><span style=3D"color:rgb(102,102,0)">&lt;</span><var>=
<span style=3D"color:rgb(0,0,136)">class</span></var><span> </span><span st=
yle=3D"color:rgb(102,0,102)">InputIterator</span><span style=3D"color:rgb(1=
02,102,0)">,</span><span> </span><var><span style=3D"color:rgb(0,0,136)">cl=
ass</span></var><span> </span><span style=3D"color:rgb(102,0,102)">UnaryPre=
dicate</span><span style=3D"color:rgb(102,102,0)">&gt;</span><span><br>






=A0 </span><var><span style=3D"color:rgb(0,0,136)">typename</span></var><sp=
an> iterator_traits</span><span style=3D"color:rgb(102,102,0)">&lt;</span><=
span style=3D"color:rgb(102,0,102)">InputIterator</span><span style=3D"colo=
r:rgb(102,102,0)">&gt;<u></u>::</span><span>difference_type<br>






=A0 =A0 count_until </span><span style=3D"color:rgb(102,102,0)">(</span><sp=
an style=3D"color:rgb(102,0,102)">InputIterator</span><span> first</span><s=
pan style=3D"color:rgb(102,102,0)">,</span><span> </span><span style=3D"col=
or:rgb(102,0,102)">InputIterator</span><span> </span><span style=3D"color:r=
gb(0,0,136)">last</span><span style=3D"color:rgb(102,102,0)">,</span><span>=
 </span><span style=3D"color:rgb(102,0,102)">UnaryPredicate</span><span> pr=
ed</span><span style=3D"color:rgb(102,102,0)">)</span><span><br>






</span><span style=3D"color:rgb(102,102,0)">{</span><span><br><code><pre><c=
ode><span>=A0 </span><var><span style=3D"color:rgb(0,0,136)">typename</span=
></var><span> iterator_traits</span><span style=3D"color:rgb(102,102,0)">&l=
t;</span><span style=3D"color:rgb(102,0,102)">InputIterator</span><span sty=
le=3D"color:rgb(102,102,0)">&gt;<u></u>::</span><span>difference_type ret <=
/span><span style=3D"color:rgb(102,102,0)">=3D</span><span> </span><span st=
yle=3D"color:rgb(0,102,102)">0</span><span style=3D"color:rgb(102,102,0)">;=
</span><span><br>






=A0 </span><var><span style=3D"color:rgb(0,0,136)">while</span></var><span>=
 </span><span style=3D"color:rgb(102,102,0)">(</span><span>first</span><spa=
n style=3D"color:rgb(102,102,0)">!=3D</span><span style=3D"color:rgb(0,0,13=
6)">last</span><var><span> </span><span style=3D"color:rgb(102,102,0)">&amp=
;&amp;</span><span> </span></var><var></var><span>!pred</span><span style=
=3D"color:rgb(102,102,0)">(*</span><span>first</span><span style=3D"color:r=
gb(102,102,0)">))</span><span> </span><span style=3D"color:rgb(102,102,0)">=
{</span><span><br>






=A0 =A0 </span><span style=3D"color:rgb(102,102,0)">++</span><span>ret</spa=
n><span style=3D"color:rgb(102,102,0)">;</span><span><br>=A0 =A0 </span><sp=
an style=3D"color:rgb(102,102,0)">++</span><span>first</span><span style=3D=
"color:rgb(102,102,0)">;</span><span><br>






=A0 </span><span style=3D"color:rgb(102,102,0)">}</span><span><br>=A0 </spa=
n><var><span style=3D"color:rgb(0,0,136)">return</span></var><span> ret;<br=
>

}</span><span style=3D"color:rgb(102,102,0)"></span></code></pre></code></s=
pan></code><code><span></span><span style=3D"color:rgb(102,102,0)"></span><=
/code></pre></div></code></div>

<br>What do you think about adding these two components to the algorithms l=
ibrary ?</div>
</blockquote></div>

<p></p>

-- <br>
=A0<br>
--- <br></div></div>
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 <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org" target=3D"_=
blank">std-proposals+unsubscribe@isocpp.org</a>.<div><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><div><div>

<p></p>

-- <br>
=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>
</div></div></blockquote></div><br></div>

<p></p>

-- <br>
=A0<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 <a href=3D"mailto:std-proposals%2Bunsubscribe@isocpp.org" target=3D=
"_blank">std-proposals+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 />

--047d7bd76d1e24bcec04e84f6afc--

.
