220 7219 <AEDAD631-3D32-421B-85CA-9C342D57A439@hsr.ch> article
Path: news.gmane.org!not-for-mail
From: Peter Sommerlad <Peter.Sommerlad@hsr.ch>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: "count_while" and "count_until" algorithms
Date: Wed, 9 Oct 2013 07:58:28 +0200
Lines: 352
Approved: news@gmane.org
Message-ID: <AEDAD631-3D32-421B-85CA-9C342D57A439@hsr.ch>
References: <CAOpASk64dV+3ZUW+Z8wcEqug_oSaztvJp1zsDB_QdAxi+fwcsA@mail.gmail.com> <a25301a7-e4c6-4245-b053-00d46ca5c7d4@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0 (1.0)
Content-Type: multipart/alternative;
	boundary="Apple-Mail-B36A059F-E1FB-4422-B3F9-1AC3C3F9687A"
Content-Transfer-Encoding: 7bit
X-Trace: ger.gmane.org 1381298310 6610 80.91.229.3 (9 Oct 2013 05:58:30 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Wed, 9 Oct 2013 05:58:30 +0000 (UTC)
To: "<std-proposals@isocpp.org>" <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBD3OHQEN4AJBBB7B2OJAKGQEJ3VOKJQ@isocpp.org Wed Oct 09 07:58:33 2013
Return-path: <std-proposals+bncBD3OHQEN4AJBBB7B2OJAKGQEJ3VOKJQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-wi0-f197.google.com ([209.85.212.197])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBD3OHQEN4AJBBB7B2OJAKGQEJ3VOKJQ@isocpp.org>)
	id 1VTmn2-0005Ng-OK
	for gclcip-std-proposals@m.gmane.org; Wed, 09 Oct 2013 07:58:32 +0200
Original-Received: by mail-wi0-f197.google.com with SMTP id hm2sf369867wib.0
        for <gclcip-std-proposals@m.gmane.org>; Tue, 08 Oct 2013 22:58:32 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=subject:references:from:in-reply-to:message-id:date:to:mime-version
         :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
         :content-transfer-encoding;
        bh=/wl/WbQa6l8AHe2n8LZsCiKY9wz4UaGlpYCkDJvmJt4=;
        b=MnqRRCC8j4S5C0cZvapbZFYIbs9kvAJWYaMI7ZyL55m6W02DCvntNn/LFwZb/JWnXq
         NpcQZr/7qyiIVi9djQTNO9PRImnLl+1O+XaTXel04R/8eYzRjlELVab5fnBHLdT1V3FA
         6Xhcd1IMEubkWikPtLIQEuzIoa8cvo9baZz03wD7tRcuhPHemH1MEonLXfpmB0wlZneg
         nSHS/aJVAknVyBOrqo48P5L0DjgBOASnCnmCt7DkU8n8b3A2ZTmYG4X4zlh48MQY/bdE
         N9dYv9CUEFFl4BgF/OGHdJAVa85KUk8cAvDzJBIw+Y6D3JSwGnPqIVItecZVxvz1ManC
         Nc5Q==
X-Received: by 10.180.24.105 with SMTP id t9mr457290wif.5.1381298312095;
        Tue, 08 Oct 2013 22:58:32 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.180.94.198 with SMTP id de6ls1394950wib.12.canary; Tue, 08 Oct
 2013 22:58:31 -0700 (PDT)
X-Received: by 10.15.94.201 with SMTP id bb49mr8858916eeb.23.1381298311091;
        Tue, 08 Oct 2013 22:58:31 -0700 (PDT)
Original-Received: from mx2.hsr.ch (mx2.hsr.ch. [2001:620:130:a036::51])
        by mx.google.com with ESMTP id x42si30567103eea.284.1969.12.31.16.00.00;
        Tue, 08 Oct 2013 22:58:31 -0700 (PDT)
Received-SPF: pass (google.com: best guess record for domain of psommerl@hsr.ch designates 2001:620:130:a036::51 as permitted sender) client-ip=2001:620:130:a036::51;
Original-Received: from localhost (localhost [127.0.0.1])
	by mx2.hsr.ch (Postfix) with ESMTP id 0BAC1DA6
	for <std-proposals@isocpp.org>; Wed,  9 Oct 2013 07:58:31 +0200 (CEST)
Original-Received: from mx2.hsr.ch ([127.0.0.1])
	by localhost (mx2.hsr.ch [127.0.0.1]) (amavisd-new, port 10024)
	with LMTP id IIjdbHd5lw9o for <std-proposals@isocpp.org>;
	Wed,  9 Oct 2013 07:58:28 +0200 (CEST)
Original-Received: from webmail.hsr.ch (sid00201.hsr.ch [152.96.21.201])
	by mx2.hsr.ch (Postfix) with ESMTP id 50159CDF
	for <std-proposals@isocpp.org>; Wed,  9 Oct 2013 07:58:28 +0200 (CEST)
Original-Received: from [192.168.1.8] (152.96.21.55) by smtp.hsr.ch (152.96.21.201)
 with Microsoft SMTP Server (TLS) id 14.3.158.1; Wed, 9 Oct 2013 07:58:27
 +0200
X-Mailer: iPad Mail (10B329)
In-Reply-To: <a25301a7-e4c6-4245-b053-00d46ca5c7d4@isocpp.org>
X-Originating-IP: [152.96.21.55]
X-Original-Sender: peter.sommerlad@hsr.ch
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 best guess record for domain of psommerl@hsr.ch designates
 2001:620:130:a036::51 as permitted sender) smtp.mail=psommerl@hsr.ch
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:7219
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/7219>

--Apple-Mail-B36A059F-E1FB-4422-B3F9-1AC3C3F9687A
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

+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> wro=
te:

> What about creating an iterator adapter instead?  One which keeps track o=
f how many times it has been incremented?
>=20
> 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();
>=20
> Then you could apply it to other algorithms besides find/find_if.
>=20
> On Tuesday, October 8, 2013 3:04:23 PM UTC-5, R=E9my Lefevre wrote:
>>=20
>> Hi,
>>=20
>> I thought about two new algorithms, that could be named "count_while" an=
d "count_until". Here are their behavior:
>>=20
>> template <class InputIterator, class UnaryPredicate>
>>=20
>>=20
>>   typename iterator_traits<InputIterator>::difference_type
>>=20
>>=20
>>     count_while (InputIterator first, InputIterator last, UnaryPredicate=
 pred)
>>=20
>>=20
>> {
>>   typename iterator_traits<InputIterator>::difference_type ret =3D 0;
>>=20
>>=20
>>   while (first!=3Dlast && pred(*first)) {
>>=20
>>=20
>>     ++ret;
>>     ++first;
>>=20
>>=20
>>   }
>>   return ret;
>>=20
>>=20
>> }
>>=20
>> template <class InputIterator, class UnaryPredicate>
>>=20
>>=20
>>   typename iterator_traits<InputIterator>::difference_type
>>=20
>>=20
>>     count_until (InputIterator first, InputIterator last, UnaryPredicate=
 pred)
>>=20
>>=20
>> {
>>   typename iterator_traits<InputIterator>::difference_type ret =3D 0;
>>=20
>>=20
>>   while (first!=3Dlast && !pred(*first)) {
>>=20
>>=20
>>     ++ret;
>>     ++first;
>>=20
>>=20
>>   }
>>   return ret;
>>=20
>>=20
>> }
>>=20
>> What do you think about adding these two components to the algorithms li=
brary ?
>=20
> --=20
> =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=
 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-propo=
sals/.

--=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/.

--Apple-Mail-B36A059F-E1FB-4422-B3F9-1AC3C3F9687A
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<html><head><meta http-equiv=3D"content-type" content=3D"text/html; charset=
=3Dutf-8"></head><body dir=3D"auto"><div>+1 for composability instead of pr=
oliferation...</div><div><br></div><div>Do we have boost's counting iterato=
r adapter in c++14 or library TS?<br><br>Sent from Peter Sommerlad's<span c=
lass=3D"Apple-style-span" style=3D"-webkit-tap-highlight-color: rgba(26, 26=
, 26, 0.296875); -webkit-composition-fill-color: rgba(175, 192, 227, 0.2304=
69); -webkit-composition-frame-color: rgba(77, 128, 180, 0.230469); ">&nbsp=
;iPad</span></div><div><br>On 09.10.2013, at 07:13, "Benjamin Lindley" &lt;=
<a href=3D"mailto:benjameslindley@gmail.com">benjameslindley@gmail.com</a>&=
gt; wrote:<br><br></div><blockquote type=3D"cite"><div><meta http-equiv=3D"=
Content-Type" content=3D"text/html; charset=3Diso-8859-1"><div dir=3D"ltr">=
What about creating an iterator adapter instead?&nbsp; One which keeps trac=
k of how many times it has been incremented?<br><br><div class=3D"prettypri=
nt" style=3D"background-color: rgb(250, 250, 250); border-color: rgb(187, 1=
87, 187); border-style: solid; border-width: 1px; word-wrap: break-word;"><=
code class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"col=
or: #008;" class=3D"styled-by-prettify">typedef</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify"> std</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">istream_iterator</span><span style=3D"color: #080;"=
 class=3D"styled-by-prettify">&lt;int&gt;</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> base_t</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"><br>base_t ib</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify">std</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">::</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
cin</span><span style=3D"color: #660;" class=3D"styled-by-prettify">),</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> ie</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"><br>std</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">::</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify">counting_iterator</span><span style=3D"col=
or: #080;" class=3D"styled-by-prettify">&lt;base_t&gt;</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> b</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify">ib</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">),</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"> e</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">ie</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">);</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">auto</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> p </span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> std</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify">find_if</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
>b</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> e</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> pred</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">);</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"><br>std</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify">cout </span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">&lt;&lt;</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> p</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">.</span><span style=3D"color: #000;" class=3D"styled-by-prettify">count</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">();</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"><br></span></div></=
code></div><br>Then you could apply it to other algorithms besides find/fin=
d_if.<br><br>On Tuesday, October 8, 2013 3:04:23 PM UTC-5, R=E9my Lefevre w=
rote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8e=
x;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">Hi,<br><=
br>I thought about two new algorithms, that could be named "count_while" an=
d "count_until". Here are their behavior:<br><br><div style=3D"background-c=
olor:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;bord=
er-width:1px;word-wrap:break-word">

<code><div><pre><code><var><span style=3D"color:rgb(0,0,136)">template</spa=
n></var><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(1=
02,102,0)">&lt;</span><var><span style=3D"color:rgb(0,0,136)">class</span><=
/var><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,=
0,102)">InputIterator</span><span style=3D"color:rgb(102,102,0)">,</span><s=
pan style=3D"color:rgb(0,0,0)"> </span><var><span style=3D"color:rgb(0,0,13=
6)">class</span></var><span style=3D"color:rgb(0,0,0)"> </span><span style=
=3D"color:rgb(102,0,102)">UnaryPredicate</span><span style=3D"color:rgb(102=
,102,0)">&gt;</span><span style=3D"color:rgb(0,0,0)"><br>

&nbsp; </span><var><span style=3D"color:rgb(0,0,136)">typename</span></var>=
<span style=3D"color:rgb(0,0,0)"> iterator_traits</span><span style=3D"colo=
r:rgb(102,102,0)">&lt;</span><span style=3D"color:rgb(102,0,102)">InputIter=
ator</span><span style=3D"color:rgb(102,102,0)">&gt;<wbr>::</span><span sty=
le=3D"color:rgb(0,0,0)">difference_type<br>

&nbsp; &nbsp; count_while </span><span style=3D"color:rgb(102,102,0)">(</sp=
an><span style=3D"color:rgb(102,0,102)">InputIterator</span><span style=3D"=
color:rgb(0,0,0)"> first</span><span style=3D"color:rgb(102,102,0)">,</span=
><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,0,10=
2)">InputIterator</span><span style=3D"color:rgb(0,0,0)"> </span><span styl=
e=3D"color:rgb(0,0,136)">last</span><span style=3D"color:rgb(102,102,0)">,<=
/span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102=
,0,102)">UnaryPredicate</span><span style=3D"color:rgb(0,0,0)"> pred</span>=
<span style=3D"color:rgb(102,102,0)">)</span><span style=3D"color:rgb(0,0,0=
)"><br>

</span><span style=3D"color:rgb(102,102,0)">{</span><span style=3D"color:rg=
b(0,0,0)"><br>&nbsp; </span><var><span style=3D"color:rgb(0,0,136)">typenam=
e</span></var><span style=3D"color:rgb(0,0,0)"> iterator_traits</span><span=
 style=3D"color:rgb(102,102,0)">&lt;</span><span style=3D"color:rgb(102,0,1=
02)">InputIterator</span><span style=3D"color:rgb(102,102,0)">&gt;<wbr>::</=
span><span style=3D"color:rgb(0,0,0)">difference_type ret </span><span styl=
e=3D"color:rgb(102,102,0)">=3D</span><span style=3D"color:rgb(0,0,0)"> </sp=
an><span style=3D"color:rgb(0,102,102)">0</span><span style=3D"color:rgb(10=
2,102,0)">;</span><span style=3D"color:rgb(0,0,0)"><br>

&nbsp; </span><var><span style=3D"color:rgb(0,0,136)">while</span></var><sp=
an style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,102,0)">=
(</span><span style=3D"color:rgb(0,0,0)">first</span><span style=3D"color:r=
gb(102,102,0)">!=3D</span><span style=3D"color:rgb(0,0,136)">last</span><va=
r><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,102=
,0)">&amp;&amp;</span><span style=3D"color:rgb(0,0,0)"> </span></var><var><=
/var><span style=3D"color:rgb(0,0,0)">pred</span><span style=3D"color:rgb(1=
02,102,0)">(*</span><span style=3D"color:rgb(0,0,0)">first</span><span styl=
e=3D"color:rgb(102,102,0)">))</span><span style=3D"color:rgb(0,0,0)"> </spa=
n><span style=3D"color:rgb(102,102,0)">{</span><span style=3D"color:rgb(0,0=
,0)"><br>

&nbsp; &nbsp; </span><span style=3D"color:rgb(102,102,0)">++</span><span st=
yle=3D"color:rgb(0,0,0)">ret</span><span style=3D"color:rgb(102,102,0)">;</=
span><span style=3D"color:rgb(0,0,0)"><br>&nbsp; &nbsp; </span><span style=
=3D"color:rgb(102,102,0)">++</span><span style=3D"color:rgb(0,0,0)">first</=
span><span style=3D"color:rgb(102,102,0)">;</span><span style=3D"color:rgb(=
0,0,0)"><br>

&nbsp; </span><span style=3D"color:rgb(102,102,0)">}</span><span style=3D"c=
olor:rgb(0,0,0)"><br>&nbsp; </span><var><span style=3D"color:rgb(0,0,136)">=
return</span></var><span style=3D"color:rgb(0,0,0)"> ret</span><span style=
=3D"color:rgb(102,102,0)">;</span><span style=3D"color:rgb(0,0,0)"><br>

</span><span style=3D"color:rgb(102,102,0)">}</span></code></pre></div></co=
de></div><br><div style=3D"background-color:rgb(250,250,250);border-color:r=
gb(187,187,187);border-style:solid;border-width:1px;word-wrap:break-word">

<code><div><pre><code><var><span style=3D"color:rgb(0,0,136)">template</spa=
n></var><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(1=
02,102,0)">&lt;</span><var><span style=3D"color:rgb(0,0,136)">class</span><=
/var><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,=
0,102)">InputIterator</span><span style=3D"color:rgb(102,102,0)">,</span><s=
pan style=3D"color:rgb(0,0,0)"> </span><var><span style=3D"color:rgb(0,0,13=
6)">class</span></var><span style=3D"color:rgb(0,0,0)"> </span><span style=
=3D"color:rgb(102,0,102)">UnaryPredicate</span><span style=3D"color:rgb(102=
,102,0)">&gt;</span><span style=3D"color:rgb(0,0,0)"><br>

&nbsp; </span><var><span style=3D"color:rgb(0,0,136)">typename</span></var>=
<span style=3D"color:rgb(0,0,0)"> iterator_traits</span><span style=3D"colo=
r:rgb(102,102,0)">&lt;</span><span style=3D"color:rgb(102,0,102)">InputIter=
ator</span><span style=3D"color:rgb(102,102,0)">&gt;<wbr>::</span><span sty=
le=3D"color:rgb(0,0,0)">difference_type<br>

&nbsp; &nbsp; count_until </span><span style=3D"color:rgb(102,102,0)">(</sp=
an><span style=3D"color:rgb(102,0,102)">InputIterator</span><span style=3D"=
color:rgb(0,0,0)"> first</span><span style=3D"color:rgb(102,102,0)">,</span=
><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,0,10=
2)">InputIterator</span><span style=3D"color:rgb(0,0,0)"> </span><span styl=
e=3D"color:rgb(0,0,136)">last</span><span style=3D"color:rgb(102,102,0)">,<=
/span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102=
,0,102)">UnaryPredicate</span><span style=3D"color:rgb(0,0,0)"> pred</span>=
<span style=3D"color:rgb(102,102,0)">)</span><span style=3D"color:rgb(0,0,0=
)"><br>

</span><span style=3D"color:rgb(102,102,0)">{</span><span style=3D"color:rg=
b(0,0,0)"><br><code><pre><code><span style=3D"color:rgb(0,0,0)">&nbsp; </sp=
an><var><span style=3D"color:rgb(0,0,136)">typename</span></var><span style=
=3D"color:rgb(0,0,0)"> iterator_traits</span><span style=3D"color:rgb(102,1=
02,0)">&lt;</span><span style=3D"color:rgb(102,0,102)">InputIterator</span>=
<span style=3D"color:rgb(102,102,0)">&gt;<wbr>::</span><span style=3D"color=
:rgb(0,0,0)">difference_type ret </span><span style=3D"color:rgb(102,102,0)=
">=3D</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:r=
gb(0,102,102)">0</span><span style=3D"color:rgb(102,102,0)">;</span><span s=
tyle=3D"color:rgb(0,0,0)"><br>

&nbsp; </span><var><span style=3D"color:rgb(0,0,136)">while</span></var><sp=
an style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,102,0)">=
(</span><span style=3D"color:rgb(0,0,0)">first</span><span style=3D"color:r=
gb(102,102,0)">!=3D</span><span style=3D"color:rgb(0,0,136)">last</span><va=
r><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,102=
,0)">&amp;&amp;</span><span style=3D"color:rgb(0,0,0)"> </span></var><var><=
/var><span style=3D"color:rgb(0,0,0)">!pred</span><span style=3D"color:rgb(=
102,102,0)">(*</span><span style=3D"color:rgb(0,0,0)">first</span><span sty=
le=3D"color:rgb(102,102,0)">))</span><span style=3D"color:rgb(0,0,0)"> </sp=
an><span style=3D"color:rgb(102,102,0)">{</span><span style=3D"color:rgb(0,=
0,0)"><br>

&nbsp; &nbsp; </span><span style=3D"color:rgb(102,102,0)">++</span><span st=
yle=3D"color:rgb(0,0,0)">ret</span><span style=3D"color:rgb(102,102,0)">;</=
span><span style=3D"color:rgb(0,0,0)"><br>&nbsp; &nbsp; </span><span style=
=3D"color:rgb(102,102,0)">++</span><span style=3D"color:rgb(0,0,0)">first</=
span><span style=3D"color:rgb(102,102,0)">;</span><span style=3D"color:rgb(=
0,0,0)"><br>

&nbsp; </span><span style=3D"color:rgb(102,102,0)">}</span><span style=3D"c=
olor:rgb(0,0,0)"><br>&nbsp; </span><var><span style=3D"color:rgb(0,0,136)">=
return</span></var><span style=3D"color:rgb(0,0,0)"> ret;<br>

}</span><span style=3D"color:rgb(102,102,0)"></span></code></pre></code></s=
pan></code><code><span style=3D"color:rgb(0,0,0)"></span><span style=3D"col=
or: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>
&nbsp;<br>
--- <br>
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" 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">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<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>
</div></blockquote></body></html>

<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 />

--Apple-Mail-B36A059F-E1FB-4422-B3F9-1AC3C3F9687A--

.
