220 15341 <eda6ace2-d33b-47a6-ae92-48f8950b0ea6@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: ricky.65@hotmail.com
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: Isn't it time we had the bool
 std::[container]::contains() family of methods?
Date: Sat, 27 Dec 2014 07:54:03 -0800 (PST)
Lines: 116
Approved: news@gmane.org
Message-ID: <eda6ace2-d33b-47a6-ae92-48f8950b0ea6@isocpp.org>
References: <0959f2f8-acdd-4786-b6f3-0f05c62dcee6@isocpp.org> <034be173-a67f-4273-b7e8-f8c5f04e0ba3@isocpp.org>
 <549E1178.2050301@gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_108_1367063518.1419695643123"
X-Trace: ger.gmane.org 1419695654 1671 80.91.229.3 (27 Dec 2014 15:54:14 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sat, 27 Dec 2014 15:54:14 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDIITWUOTQNRBG5M7OSAKGQESVOGXRQ@isocpp.org Sat Dec 27 16:54:05 2014
Return-path: <std-proposals+bncBDIITWUOTQNRBG5M7OSAKGQESVOGXRQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ig0-f199.google.com ([209.85.213.199])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDIITWUOTQNRBG5M7OSAKGQESVOGXRQ@isocpp.org>)
	id 1Y4tgr-0002U1-38
	for gclcip-std-proposals@m.gmane.org; Sat, 27 Dec 2014 16:54:05 +0100
Original-Received: by mail-ig0-f199.google.com with SMTP id hl2sf63210927igb.6
        for <gclcip-std-proposals@m.gmane.org>; Sat, 27 Dec 2014 07:54:04 -0800 (PST)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:date:from:to:message-id:in-reply-to:references
         :subject:mime-version:content-type:x-original-sender:reply-to
         :precedence:mailing-list:list-id:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=TBkc+imdujgl5BfkASQMsCfBbNrllzJ0S1ZEXledUNc=;
        b=KvBuc+EX0n+bcoSoTp49H1+x1OWSbSUQWAAIBcPxsHCSf5D9ns6Z7t+BmvK8V2b4jz
         dtFe7cxXQyGcls78LqB6iy3lL56ut4e0gyrPKj6aCkkL7+rDrf9B2CAzgkzD3IbBh3qQ
         N5R95dz+G8BJcEmL82GNwAC5PSiyaiRGP4Ft7SWjop3u2PI65SZi6LD/DxSGDjsN5rNH
         HL72PerhOYEv49SUPO/Znv01/DOvhk8y5y0qj9mKZlqnCMnsrRhzbZPodyf66j9vWiG7
         zvs1MoLZAtIToUi7mJpBBcwH24YjjTWO0j4q4MfRLCfRbZEEP3UfeK0MYhodcGwJIeBv
         KKtg==
X-Gm-Message-State: ALoCoQmqJmXcQ2Dlw81EfeAbgtD8tNNqhPBgbVySK9yPINnK5sfHFbrpauXuNr22jsJhTZve4Xso
X-Received: by 10.182.29.101 with SMTP id j5mr36233818obh.32.1419695644165;
        Sat, 27 Dec 2014 07:54:04 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.140.29.7 with SMTP id a7ls4790036qga.87.gmail; Sat, 27 Dec
 2014 07:54:03 -0800 (PST)
X-Received: by 10.140.22.48 with SMTP id 45mr742055qgm.5.1419695643503;
        Sat, 27 Dec 2014 07:54:03 -0800 (PST)
In-Reply-To: <549E1178.2050301@gmail.com>
X-Original-Sender: ricky.65@hotmail.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: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:15341
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/15341>

------=_Part_108_1367063518.1419695643123
Content-Type: multipart/alternative; 
	boundary="----=_Part_109_309007773.1419695643123"

------=_Part_109_309007773.1419695643123
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On Saturday, December 27, 2014 1:55:10 AM UTC, Germinolegrand wrote:
>
> Le 27/12/2014 01:49, rick...@hotmail.com <javascript:> a =C3=A9crit :=20
> > Doesn't the "any_of" algorithm serve this purpose?=20
> > --=20
> Isn't std::any_of a predicate only algorithm in the standard ? Although=
=20
> it would make sense to fulfill the goal of a "contains" by extending=20
> std::any_of, ... maybe std::any ? Oups, seems to be already conflicting=
=20
> with a possible boost::any...=20
> Would have been simpler if we had have std::any_of_if :-/=20
>

Yes, std::any_of just takes a predicate. I agree that it would be very=20
useful if there were a version which accepts a value instead of a predicate=
=20
(the same applies for std::all_of and std::none_of).=20

As you said, it does appear that there would be an unfortunate name clash=
=20
with the proposed boost::any if a "value" version called std::any were=20
provided.

Short of inventing a time machine I don't think it would be feasible to=20
rename std::any_of to std::any_of_if!

With Concepts Lite it should be possible to have a "value" overload as we=
=20
can overload on concepts. For example, something like the following:

template<InputIterator I, Predicate<ValueType<I>> P>
bool any_of(I first, I last, P pred);

template<InputIterator I, EqualityComparable<ValueType<I>> T>
bool any_of(I first, I last, const T& value);

This would be my favoured option.

Riccardo

--=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_109_309007773.1419695643123
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Saturday, December 27, 2014 1:55:10 AM UTC, Germinolegr=
and wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left:=
 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">Le 27/12/2014 01:49,=
 <a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"xx2HIz8=
e5cEJ" onmousedown=3D"this.href=3D'javascript:';return true;" onclick=3D"th=
is.href=3D'javascript:';return true;">rick...@hotmail.com</a> a =C3=A9crit =
:
<br>&gt; Doesn't the "any_of" algorithm serve this purpose?
<br>&gt; --=20
<br>Isn't std::any_of a predicate only algorithm in the standard ? Although=
=20
<br>it would make sense to fulfill the goal of a "contains" by extending=20
<br>std::any_of, ... maybe std::any ? Oups, seems to be already conflicting=
=20
<br>with a possible boost::any...
<br>Would have been simpler if we had have std::any_of_if :-/
<br></blockquote><div><br></div><div>Yes, std::any_of just takes a predicat=
e. I agree that it would be very useful if there were a version which accep=
ts a value instead of a predicate (the same applies for std::all_of and std=
::none_of).&nbsp;</div><div><br></div><div>As you said, it does appear that=
 there would be an unfortunate name clash with the proposed boost::any if a=
 "value" version called std::any were provided.</div><div><br></div><div>Sh=
ort of inventing a time machine I don't think it would be feasible to renam=
e std::any_of to std::any_of_if!</div><div><br></div><div>With Concepts Lit=
e it should be possible to have a "value" overload as we can overload on co=
ncepts. For example, something like the following:</div><div><br></div><div=
><div>template&lt;InputIterator I, Predicate&lt;ValueType&lt;I&gt;&gt; P&gt=
;</div><div>bool any_of(I first, I last, P pred);</div></div><div><br></div=
><div><div>template&lt;InputIterator I, EqualityComparable&lt;ValueType&lt;=
I&gt;&gt; T&gt;</div><div>bool&nbsp;any_of(I first, I last, const T&amp; va=
lue);</div></div><div><br></div><div>This would be my favoured option.</div=
><div><br></div><div>Riccardo</div></div>

<p></p>

-- <br />
<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+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 />

------=_Part_109_309007773.1419695643123--
------=_Part_108_1367063518.1419695643123--

.
