220 7173 <b910005f-d42e-401e-abda-866a10109ad0@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: Vlad from Moscow <vlad.moscow@mail.ru>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: "count_while" and "count_until" algorithms
Date: Tue, 8 Oct 2013 13:40:18 -0700 (PDT)
Lines: 361
Approved: news@gmane.org
Message-ID: <b910005f-d42e-401e-abda-866a10109ad0@isocpp.org>
References: <CAOpASk64dV+3ZUW+Z8wcEqug_oSaztvJp1zsDB_QdAxi+fwcsA@mail.gmail.com>
 <285a478e-ce03-42b9-9196-c7d0855e11aa@isocpp.org>
 <82850309-b16b-44bd-b478-e2e63e43d6ca@isocpp.org>
 <f5a8968e-3d90-49b3-82a6-c65ac5bbc8a6@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; 
	boundary="----=_Part_551_5641249.1381264818642"
X-Trace: ger.gmane.org 1381264835 3967 80.91.229.3 (8 Oct 2013 20:40:35 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Tue, 8 Oct 2013 20:40:35 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCXLLRHD7IDRBNG32GJAKGQEMKRKVSI@isocpp.org Tue Oct 08 22:40:40 2013
Return-path: <std-proposals+bncBCXLLRHD7IDRBNG32GJAKGQEMKRKVSI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ob0-f200.google.com ([209.85.214.200])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCXLLRHD7IDRBNG32GJAKGQEMKRKVSI@isocpp.org>)
	id 1VTe59-0007Vb-Lc
	for gclcip-std-proposals@m.gmane.org; Tue, 08 Oct 2013 22:40:39 +0200
Original-Received: by mail-ob0-f200.google.com with SMTP id wo20sf4497917obc.3
        for <gclcip-std-proposals@m.gmane.org>; Tue, 08 Oct 2013 13:40:38 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe
         :content-type;
        bh=rfcB1ba672L7Brq1HiaEiQ5hO4a47C+UJvxn1TGgHbg=;
        b=SVe5Jx5BJ9fZyGEsoDzFI9fsVDzAYJv5meB6iGc3fhqIx52XonXCNmBs7UpnKQaSGM
         7UHPYarVuNtkTT4KZaCQoXhqsRUzbkIl5r0E3hucE5blJRfkPke/O9VlC9k6gXanS46O
         lRGWFWzNGcoMuwp0VfyE+ykjEIwyjDyqNCCJPB7hVrBVJ3bsRa6ZGcJxNSivzwbDxlrt
         Ok6BLDhNgwPW036k3VZBS1B+jKaoNKkt+hyXSyd/7HEdxCxJcY6z1/rZITw5E+6jIr2/
         xkbhyWTNg5O3zCfxGwdBSi0vCd/UoOYfa4pHk7cqItVlg+XPqz6kLzI22bFanYDJnxcM
         i55A==
X-Received: by 10.42.61.197 with SMTP id v5mr2021762ich.32.1381264837186;
        Tue, 08 Oct 2013 13:40:37 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.50.80.15 with SMTP id n15ls3680386igx.39.canary; Tue, 08 Oct
 2013 13:40:20 -0700 (PDT)
X-Received: by 10.50.83.6 with SMTP id m6mr945681igy.1.1381264820285;
        Tue, 08 Oct 2013 13:40:20 -0700 (PDT)
In-Reply-To: <f5a8968e-3d90-49b3-82a6-c65ac5bbc8a6@isocpp.org>
X-Original-Sender: vlad.moscow@mail.ru
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:7173
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/7173>

------=_Part_551_5641249.1381264818642
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

As any negation of an unary predicate can be written as std::not1(=20
unary_predicate ) there is enough to propose only one algorithm namely with=
=20
name count_first_if.:)

=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., 0:37:13 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 Vlad from Moscow=20
=D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:

> So I would propose name count_first_if instead of the both suggested=20
> algorithms count_until and count_while.
> =20
>
> =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., 0:35:01 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 Vlad from Moscow=20
> =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:
>
>> Or the following definition
>> =20
>> [code]
>> template <class InputIterator, class T, class UnaryPredicate>
>> T accumulate_first_if( InputIterator first,=20
>>                     InputIterator last,
>>         T init,
>>         UnaryPredicate unary_predicate )
>> {
>>  for ( ; first !=3D last && unary_predicate( *first ) ; ++first )
>>  {
>>   init =3D ( T )( init + *first );
>>  }
>>  return ( init );
>> }
>> [/code]
>>
>> =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., 0:32:31 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 Vlad from Moscow=20
>> =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:
>>
>>> =20
>>> [code]
>>> In some thread here I proposed the similar idea for algorithm=20
>>> std::accumulate.
>>> template <class InputIterator, class T, class UnaryPredicate, class=20
>>> BinaryOperation>
>>> T accumulate_first_if( InputIterator first,=20
>>>                     InputIterator last,
>>>         T init,
>>>         UnaryPredicate unary_predicate,
>>>         BinaryOperation binary_operation )
>>> {
>>>  for ( ; first !=3D last && unary_predicate( *first ) ; ++first )
>>>  {
>>>   init =3D binary_operation( init, *first );
>>>  }
>>>  return ( init );
>>> }
>>> [/code]
>>> =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., 0:04:23 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=20
>>> =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:
>>>
>>>> Hi,
>>>>
>>>> I thought about two new algorithms, that could be named "count_while"=
=20
>>>> 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=
=20
>>>> library ?
>>>>
>>>

--=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/.

------=_Part_551_5641249.1381264818642
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>As any negation of an unary predicate can be written =
as std::not1( unary_predicate ) there is enough to propose only one algorit=
hm namely with name count_first_if.:)</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&nbsp;=D0=B3., =
0:37:13 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 Vlad from Moscow =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:</=
div><blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; p=
adding-left: 1ex; border-left-color: rgb(204, 204, 204); border-left-width:=
 1px; border-left-style: solid;"><div dir=3D"ltr"><div>So I would propose n=
ame count_first_if instead of the both suggested algorithms count_until and=
 count_while.</div><div>&nbsp;</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&nbsp;=D0=B3., 0:35:01 U=
TC+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 Vlad from Moscow =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:</div><bloc=
kquote class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; padding-le=
ft: 1ex; border-left-color: rgb(204, 204, 204); border-left-width: 1px; bor=
der-left-style: solid;"><div dir=3D"ltr"><div>Or the following definition</=
div><div>&nbsp;</div><div>[code]</div><div>template &lt;class InputIterator=
, class T, class UnaryPredicate&gt;<br>T accumulate_first_if( InputIterator=
 first, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; InputIterator last,<br>=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; T init,<br>&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp; UnaryPredicate unary_predicate )<br>{<br>&nbsp;for ( =
; first !=3D last &amp;&amp; unary_predicate( *first ) ; ++first )<br>&nbsp=
;{<br>&nbsp;&nbsp;init =3D ( T )( init + *first );<br>&nbsp;}</div><div>&nb=
sp;return ( init );<br>}<br></div><div>[/code]</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&nbsp;=
=D0=B3., 0:32:31 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 Vlad from Moscow =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=
=D0=BB:</div><blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px 0px=
 0.8ex; padding-left: 1ex; border-left-color: rgb(204, 204, 204); border-le=
ft-width: 1px; border-left-style: solid;"><div dir=3D"ltr"><div>&nbsp;</div=
><div>[code]</div><div>In some thread here I proposed the similar idea for =
algorithm std::accumulate.</div><div>template &lt;class InputIterator, clas=
s T, class UnaryPredicate, class BinaryOperation&gt;<br>T accumulate_first_=
if( InputIterator first, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; InputI=
terator last,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; T init,<br>&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; UnaryPredicate unary_predicate,<br>&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BinaryOperation binary_operation =
)<br>{<br>&nbsp;for ( ; first !=3D last &amp;&amp; unary_predicate( *first =
) ; ++first )<br>&nbsp;{<br>&nbsp;&nbsp;init =3D binary_operation( init, *f=
irst );<br>&nbsp;}</div><div>&nbsp;return ( init );<br>}<br></div><div>[/co=
de]<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&nbsp;=D0=B3., 0:04:23 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:</div><blockquote class=3D"gmail_quote" styl=
e=3D"margin: 0px 0px 0px 0.8ex; padding-left: 1ex; border-left-color: rgb(2=
04, 204, 204); border-left-width: 1px; border-left-style: solid;"><div dir=
=3D"ltr">Hi,<br><br>I thought about two new algorithms, that could be named=
 "count_while" and "count_until". Here are their behavior:<br><br><div styl=
e=3D"border: 1px solid rgb(187, 187, 187); word-wrap: break-word; backgroun=
d-color: rgb(250, 250, 250);">

<code><div><pre><code><var><span style=3D"color: rgb(0, 0, 136);">template<=
/span></var><span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"col=
or: rgb(102, 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 sty=
le=3D"color: rgb(102, 0, 102);">InputIterator</span><span style=3D"color: r=
gb(102, 102, 0);">,</span><span style=3D"color: rgb(0, 0, 0);"> </span><var=
><span style=3D"color: rgb(0, 0, 136);">class</span></var><span style=3D"co=
lor: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(102, 0, 102);">UnaryP=
redicate</span><span style=3D"color: rgb(102, 102, 0);">&gt;</span><span st=
yle=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"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;<wb=
r>::</span><span style=3D"color: rgb(0, 0, 0);">difference_type<br>

&nbsp; &nbsp; count_while </span><span style=3D"color: rgb(102, 102, 0);">(=
</span><span style=3D"color: rgb(102, 0, 102);">InputIterator</span><span s=
tyle=3D"color: rgb(0, 0, 0);"> first</span><span style=3D"color: rgb(102, 1=
02, 0);">,</span><span style=3D"color: rgb(0, 0, 0);"> </span><span style=
=3D"color: rgb(102, 0, 102);">InputIterator</span><span style=3D"color: rgb=
(0, 0, 0);"> </span><span style=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"colo=
r: rgb(0, 0, 0);"><br>&nbsp; </span><var><span style=3D"color: rgb(0, 0, 13=
6);">typename</span></var><span style=3D"color: rgb(0, 0, 0);"> iterator_tr=
aits</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;<wbr>::</span><span style=3D"color: rgb(0, 0, 0);">diff=
erence_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: rgb(0, 10=
2, 102);">0</span><span style=3D"color: rgb(102, 102, 0);">;</span><span st=
yle=3D"color: rgb(0, 0, 0);"><br>

&nbsp; </span><var><span style=3D"color: rgb(0, 0, 136);">while</span></var=
><span 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: rgb(102, 102, 0);">!=3D</span><span style=3D"color: rgb(0, =
0, 136);">last</span><var><span style=3D"color: rgb(0, 0, 0);"> </span><spa=
n 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 style=3D"color: rgb(102, 102, 0=
);">))</span><span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"co=
lor: 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><spa=
n style=3D"color: rgb(0, 0, 0);">ret</span><span style=3D"color: rgb(102, 1=
02, 0);">;</span><span style=3D"color: rgb(0, 0, 0);"><br>&nbsp; &nbsp; </s=
pan><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);">;</spa=
n><span style=3D"color: rgb(0, 0, 0);"><br>

&nbsp; </span><span style=3D"color: rgb(102, 102, 0);">}</span><span style=
=3D"color: 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>=
</code></div><br><div style=3D"border: 1px solid rgb(187, 187, 187); word-w=
rap: break-word; background-color: rgb(250, 250, 250);">

<code><div><pre><code><var><span style=3D"color: rgb(0, 0, 136);">template<=
/span></var><span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"col=
or: rgb(102, 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 sty=
le=3D"color: rgb(102, 0, 102);">InputIterator</span><span style=3D"color: r=
gb(102, 102, 0);">,</span><span style=3D"color: rgb(0, 0, 0);"> </span><var=
><span style=3D"color: rgb(0, 0, 136);">class</span></var><span style=3D"co=
lor: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(102, 0, 102);">UnaryP=
redicate</span><span style=3D"color: rgb(102, 102, 0);">&gt;</span><span st=
yle=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"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;<wb=
r>::</span><span style=3D"color: rgb(0, 0, 0);">difference_type<br>

&nbsp; &nbsp; count_until </span><span style=3D"color: rgb(102, 102, 0);">(=
</span><span style=3D"color: rgb(102, 0, 102);">InputIterator</span><span s=
tyle=3D"color: rgb(0, 0, 0);"> first</span><span style=3D"color: rgb(102, 1=
02, 0);">,</span><span style=3D"color: rgb(0, 0, 0);"> </span><span style=
=3D"color: rgb(102, 0, 102);">InputIterator</span><span style=3D"color: rgb=
(0, 0, 0);"> </span><span style=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"colo=
r: rgb(0, 0, 0);"><br><code><pre><code><span style=3D"color: rgb(0, 0, 0);"=
>&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 styl=
e=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;<w=
br>::</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: r=
gb(0, 0, 0);"> </span><span style=3D"color: rgb(0, 102, 102);">0</span><spa=
n style=3D"color: rgb(102, 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=
><span 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: rgb(102, 102, 0);">!=3D</span><span style=3D"color: rgb(0, =
0, 136);">last</span><var><span style=3D"color: rgb(0, 0, 0);"> </span><spa=
n 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 styl=
e=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"c=
olor: 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><spa=
n style=3D"color: rgb(0, 0, 0);">ret</span><span style=3D"color: rgb(102, 1=
02, 0);">;</span><span style=3D"color: rgb(0, 0, 0);"><br>&nbsp; &nbsp; </s=
pan><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);">;</spa=
n><span style=3D"color: rgb(0, 0, 0);"><br>

&nbsp; </span><span style=3D"color: rgb(102, 102, 0);">}</span><span style=
=3D"color: 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=
></span></code><code><span style=3D"color: rgb(0, 0, 0);"></span><span styl=
e=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></blockquote></div></blockquote></div></blockquote></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 />

------=_Part_551_5641249.1381264818642--

.
