220 15378 <3516872.4RhFvKrMWZ@tjmaciei-mobl4> article
Path: news.gmane.org!not-for-mail
From: Thiago Macieira <thiago@macieira.org>
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: Mon, 29 Dec 2014 23:42:14 -0200
Lines: 43
Approved: news@gmane.org
Message-ID: <3516872.4RhFvKrMWZ@tjmaciei-mobl4>
References: <0959f2f8-acdd-4786-b6f3-0f05c62dcee6@isocpp.org> <3990670.unDteUsXEa@tjmaciei-mobl4> <CAA7U3HPSNtu3BaXCKWseQEf1tehfgosAHrWdODEE1ELNzf38gw@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
X-Trace: ger.gmane.org 1419903745 24780 80.91.229.3 (30 Dec 2014 01:42:25 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Tue, 30 Dec 2014 01:42:25 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCB4TK757YBRB6UFRCSQKGQEWSRVPIQ@isocpp.org Tue Dec 30 02:42:20 2014
Return-path: <std-proposals+bncBCB4TK757YBRB6UFRCSQKGQEWSRVPIQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ee0-f72.google.com ([74.125.83.72])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCB4TK757YBRB6UFRCSQKGQEWSRVPIQ@isocpp.org>)
	id 1Y5lpE-0001lz-D9
	for gclcip-std-proposals@m.gmane.org; Tue, 30 Dec 2014 02:42:20 +0100
Original-Received: by mail-ee0-f72.google.com with SMTP id e53sf8531460eek.7
        for <gclcip-std-proposals@m.gmane.org>; Mon, 29 Dec 2014 17:42:19 -0800 (PST)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:from:to:subject:date:message-id:user-agent
         :in-reply-to:references:mime-version:content-type:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe;
        bh=rSEqwS22YAtl9R/Eupt6f4VPSYBl1+Jg8q84S28Dk8U=;
        b=KAOWReDZJbvaTxYoMMAJ4vCykmnGKvkOno8WxKzX9j02dGAgBB4rb7bIxBZ6K5k2pF
         2XpMmv+Z63H9QVOWCUceO9BjTXDmy9gjXFB4F0NNbibHy3iujksSSJM+h2+ds/7WKKm7
         XwNVBXy8XE593DgFWru82DoxoBopyLDlvFBAoAkDvyVOgai6+zhNjLaNN+/WJGvnDZOQ
         o/abq2RbN3v1qdeWuV6hkAtbMbD0KM2BWQMNpvBBLD38huyZJBAYIl3RTF1j3VtIWlWM
         3bNLBw1LZ2zfzrXl70j7HZfZkFU18cFJNhjASThLFp2A07F2hUEsSb+z6BcwUs9xDULG
         4gEw==
X-Gm-Message-State: ALoCoQlC7/4Jy0IVKi6ZPo/RE8a8AK1REfb7UnFJS+G+qpjpjByr3P5DiWdhBiMWLeku6muuOKnt
X-Received: by 10.180.77.167 with SMTP id t7mr6202092wiw.6.1419903739722;
        Mon, 29 Dec 2014 17:42:19 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.180.93.101 with SMTP id ct5ls1834793wib.22.canary; Mon, 29 Dec
 2014 17:42:18 -0800 (PST)
X-Received: by 10.194.188.13 with SMTP id fw13mr112956925wjc.83.1419903738570;
        Mon, 29 Dec 2014 17:42:18 -0800 (PST)
Original-Received: from gondolin.macieira.info (gondolin.macieira.info. [78.47.120.188])
        by mx.google.com with ESMTP id jx7si62365861wid.54.2014.12.29.17.42.18
        for <std-proposals@isocpp.org>;
        Mon, 29 Dec 2014 17:42:18 -0800 (PST)
Received-SPF: pass (google.com: domain of thiago@macieira.org designates 78.47.120.188 as permitted sender) client-ip=78.47.120.188;
Original-Received: from tjmaciei-mobl4.localnet (unknown [189.0.120.56])
	by gondolin.macieira.info (Postfix) with ESMTPSA id B93A511BAF3
	for <std-proposals@isocpp.org>; Mon, 29 Dec 2014 17:42:17 -0800 (PST)
User-Agent: KMail/4.14.3 (Linux/3.11.10-21-desktop; KDE/4.14.3; x86_64; ; )
In-Reply-To: <CAA7U3HPSNtu3BaXCKWseQEf1tehfgosAHrWdODEE1ELNzf38gw@mail.gmail.com>
X-Original-Sender: thiago@macieira.org
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of thiago@macieira.org designates 78.47.120.188 as permitted sender) smtp.mail=thiago@macieira.org
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:15378
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/15378>

On Monday 29 December 2014 19:17:49 Olaf van der Spek wrote:
> Are you a QT dev? If so, could you file issues to improve these?

Yes.

> > Another case I've found is the checking if an element is present in a
> > container before inserting it. That indicates we need a new method to
> > "insert
> > if not present" and the find method would not have helped.
> 
> The find method can easily be used as a contains method. How would it
> not have helped?

Because the pattern is:

	if (!container.contains(x))
		container.insert(x, value);

Using find wouldn't help since it would still require two lookups (once for 
searching, once for inserting).

> > QString is a container, so it's a valid match. It's not easy to do a full
> > match due to -fvisibility-inlines-hidden.
> 
> But it's not the traditional one-element find, would it work with a
> generic contains?

It has a contains(QChar), in spite of having other ones.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

-- 

--- 
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/.

.
