220 15411 <54A3F4C5.5020007@mail1.stofanet.dk> article
Path: news.gmane.org!not-for-mail
From: Bjorn Reese <breese@mail1.stofanet.dk>
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: Wed, 31 Dec 2014 14:06:13 +0100
Lines: 20
Approved: news@gmane.org
Message-ID: <54A3F4C5.5020007@mail1.stofanet.dk>
References: <0959f2f8-acdd-4786-b6f3-0f05c62dcee6@isocpp.org> <3990670.unDteUsXEa@tjmaciei-mobl4> <CAA7U3HPSNtu3BaXCKWseQEf1tehfgosAHrWdODEE1ELNzf38gw@mail.gmail.com> <3516872.4RhFvKrMWZ@tjmaciei-mobl4>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
X-Trace: ger.gmane.org 1420031184 24689 80.91.229.3 (31 Dec 2014 13:06:24 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Wed, 31 Dec 2014 13:06:24 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCRLNYMEK4IMP2MPUUCRUBGEDEGPO@isocpp.org Wed Dec 31 14:06:17 2014
Return-path: <std-proposals+bncBCRLNYMEK4IMP2MPUUCRUBGEDEGPO@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-we0-f199.google.com ([74.125.82.199])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCRLNYMEK4IMP2MPUUCRUBGEDEGPO@isocpp.org>)
	id 1Y6Iye-0002Mc-PQ
	for gclcip-std-proposals@m.gmane.org; Wed, 31 Dec 2014 14:06:16 +0100
Original-Received: by mail-we0-f199.google.com with SMTP id k11sf1268747wes.2
        for <gclcip-std-proposals@m.gmane.org>; Wed, 31 Dec 2014 05:06:16 -0800 (PST)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to
         :subject:references:in-reply-to: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=ngJdO6FhNZCbAjNMMRhDt2Zh5ZHgl8xQuLjYILw7Zuo=;
        b=WJ48UOMqBruX0vjg2RM/P3NEPzKK+zxoblE7hU0VLkatiKKrn24joNNBr038trxCSh
         fEOWNaWTt0iYe/bMcKmYhwgSt82LDEFTWsGW05jxJ4rpaKQMaQep9GjVCsivqp3rxpze
         vwVb4eX4juXp3LM3A5IMPctI1OVDYX1Rt3SA5+EvlaMLg0ZyXxWIQGu78tYb5raU75du
         XjwUt8gNi1j11BjNHJys99yEDsqO2NrzFOVW8MU4ioIp3EgNOvN9aiGLSlaxN+n6rySx
         s/NHmAy2VowOqeolyOzTiFbn67hGlXQII8UUsIQNBVafQ8nEXqdrZXUj381vbwt/3or8
         W8mA==
X-Gm-Message-State: ALoCoQm20Qswg2Q7irImth01ue+7cdM1Vjbs4Vcp2Ai7o1u9xcsvY44OY3H4WuI/sCR0vH1jW0d0
X-Received: by 10.194.95.74 with SMTP id di10mr7795514wjb.0.1420031176250;
        Wed, 31 Dec 2014 05:06:16 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.180.221.195 with SMTP id qg3ls2103093wic.52.canary; Wed, 31
 Dec 2014 05:06:15 -0800 (PST)
X-Received: by 10.194.191.227 with SMTP id hb3mr132486790wjc.79.1420031175195;
        Wed, 31 Dec 2014 05:06:15 -0800 (PST)
Original-Received: from mx-aarh-5.stofanet.dk (mx-aarh-5.stofanet.dk. [212.10.10.16])
        by mx.google.com with ESMTPS id cu3si84199254wjb.20.2014.12.31.05.06.15
        for <std-proposals@isocpp.org>
        (version=TLSv1.2 cipher=RC4-SHA bits=128/128);
        Wed, 31 Dec 2014 05:06:15 -0800 (PST)
Received-SPF: none (google.com: breese@mail1.stofanet.dk does not designate permitted sender hosts) client-ip=212.10.10.16;
Original-Received: from 56340df4.rev.stofanet.dk ([86.52.13.244] helo=[192.168.1.145])
	by mx-aarh-5.stofanet.dk (envelope-from
	<breese@mail1.stofanet.dk>)
	with esmtpa id 1Y6Iyc-00032l-2E
	for std-proposals@isocpp.org; Wed, 31 Dec 2014 14:06:14 +0100
User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.3.0
In-Reply-To: <3516872.4RhFvKrMWZ@tjmaciei-mobl4>
X-Original-Sender: breese@mail1.stofanet.dk
X-Original-Authentication-Results: mx.google.com;       spf=none (google.com:
 breese@mail1.stofanet.dk does not designate permitted sender hosts) smtp.mail=breese@mail1.stofanet.dk
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:15411
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/15411>

On 12/30/2014 02:42 AM, Thiago Macieira wrote:

> Because the pattern is:
>
> 	if (!container.contains(x))
> 		container.insert(x, value);

Both ordered and unordered map insert() checks if the key already
exists, so you can just use:

   container.insert(x, value);

-- 

--- 
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/.

.
