220 13715 <m0unil$p9a$1@ger.gmane.org> article
Path: news.gmane.org!not-for-mail
From: Matthew Woehlke <mw_triad@users.sourceforge.net>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Generic std::size, a la std::begin
Date: Mon, 06 Oct 2014 14:38:13 -0400
Lines: 39
Approved: news@gmane.org
Message-ID: <m0unil$p9a$1@ger.gmane.org>
References: <8808df5e-62c4-459d-acd9-00e63adb9476@isocpp.org> <20141004004445.GA8207@lenovo> <CB0A8C8F-02D1-449C-B41C-5AE9FE6AB069@gmail.com> <c698550a-9ed6-457c-9dcb-a8aed3d0b737@isocpp.org> <m0uhol$4u1$1@ger.gmane.org> <890596a6-4fe4-4fe4-b96b-0196aaac94cf@isocpp.org> <m0ujnf$2ae$1@ger.gmane.org> <fa0e8ded-3647-4654-b40b-cc7753c3f2c3@isocpp.org> <e6301c00-99e9-4bd8-a9f0-ad91cc3e5626@isocpp.org>
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 1412620724 27610 80.91.229.3 (6 Oct 2014 18:38:44 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Mon, 6 Oct 2014 18:38:44 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCO5FYHBU4ERBKGDZOQQKGQEIZZL6GY@isocpp.org Mon Oct 06 20:38:37 2014
Return-path: <std-proposals+bncBCO5FYHBU4ERBKGDZOQQKGQEIZZL6GY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-lb0-f198.google.com ([209.85.217.198])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCO5FYHBU4ERBKGDZOQQKGQEIZZL6GY@isocpp.org>)
	id 1XbDB4-00043J-7O
	for gclcip-std-proposals@m.gmane.org; Mon, 06 Oct 2014 20:38:34 +0200
Original-Received: by mail-lb0-f198.google.com with SMTP id 10sf3157755lbg.5
        for <gclcip-std-proposals@m.gmane.org>; Mon, 06 Oct 2014 11:38:34 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:to:from:subject:date:lines:message-id:references
         :mime-version:user-agent:in-reply-to: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;
        bh=bel+y2N1gKcbc3Y99g+x7NY46cGRkC87J30vJuvcY7A=;
        b=hM9VNeb/k5+tEzglP+mD24CE1XRfCTzfH6VSgIfQcrRIG6aTic9cjWVfFNEMma5wCR
         5RZZ4ySQ69VbIkxPvJj5B+1/uqV2PquJH/cJwHiOC41nFcohTmXk+Ftk2UtwEKh586jd
         +yK1A12N2yuA4A4hdB0UbIc2M3EeYlWv+vpmAkdS0gjDosCG401CYr0tOAMmX6uAJNUg
         oQOE6TX47wYMYI3nDUdjCJ4RuAa4bRqbCTWxzv+uiVz6Vc7cGZK3HpU/HdOuF9XG15jW
         DEhOCL8k+EsAeBldH+lgzyvVDHOXZDf65T50+mtU8XL/6qq7kvBganUMpI+E9wGSqNLe
         zHSQ==
X-Gm-Message-State: ALoCoQmDrgJZP3saa1CeFEI2QbF0ABFFM+mPABJDtFZAMVShNpphpjeD+U2G/Udnqihl+DQIxPYX
X-Received: by 10.180.101.194 with SMTP id fi2mr2774709wib.2.1412620714002;
        Mon, 06 Oct 2014 11:38:34 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.152.26.72 with SMTP id j8ls111537lag.105.gmail; Mon, 06 Oct
 2014 11:38:32 -0700 (PDT)
X-Received: by 10.152.25.129 with SMTP id c1mr27701793lag.14.1412620712250;
        Mon, 06 Oct 2014 11:38:32 -0700 (PDT)
Original-Received: from plane.gmane.org (plane.gmane.org. [80.91.229.3])
        by mx.google.com with ESMTPS id sd8si25343816lbb.36.2014.10.06.11.38.32
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=RC4-SHA bits=128/128);
        Mon, 06 Oct 2014 11:38:32 -0700 (PDT)
Received-SPF: pass (google.com: domain of gclcip-std-proposals@m.gmane.org designates 80.91.229.3 as permitted sender) client-ip=80.91.229.3;
Original-Received: from list by plane.gmane.org with local (Exim 4.69)
	(envelope-from <gclcip-std-proposals@m.gmane.org>)
	id 1XbDAv-0003yE-67
	for std-proposals@isocpp.org; Mon, 06 Oct 2014 20:38:25 +0200
Original-Received: from cpe-67-240-43-113.nycap.res.rr.com ([67.240.43.113])
        by main.gmane.org with esmtp (Gmexim 0.1 (Debian))
        id 1AlnuQ-0007hv-00
        for <std-proposals@isocpp.org>; Mon, 06 Oct 2014 20:38:25 +0200
Original-Received: from mw_triad by cpe-67-240-43-113.nycap.res.rr.com with local (Gmexim 0.1 (Debian))
        id 1AlnuQ-0007hv-00
        for <std-proposals@isocpp.org>; Mon, 06 Oct 2014 20:38:25 +0200
X-Injected-Via-Gmane: http://gmane.org/
Original-Lines: 30
Original-X-Complaints-To: usenet@ger.gmane.org
X-Gmane-NNTP-Posting-Host: cpe-67-240-43-113.nycap.res.rr.com
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.1
In-Reply-To: <e6301c00-99e9-4bd8-a9f0-ad91cc3e5626@isocpp.org>
X-Original-Sender: mw_triad@users.sourceforge.net
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of gclcip-std-proposals@m.gmane.org designates 80.91.229.3 as
 permitted sender) smtp.mail=gclcip-std-proposals@m.gmane.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:13715
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/13715>

On 2014-10-06 14:16, Vlad from Moscow wrote:
> Also some containers as for example associative containers have member 
> function count. So using general function with the same name will only 
> confuse users.

Why do you think that? As I already stated, I consider this a *feature*.
"count" returns a number of elements.

There are / would be several possible ways to invoke "count":

- std::count(container)
  ...counts items in <container>
- std::count(container, predicate)
  ...counts items in <container> that match <predicate>
- std::count(begin, end)
  ...counts items in [<begin>, <end>)
- std::count(begin, end, predicate)
  ...counts items in [<begin>, <end>) that match <predicate>
- container::count()
  ...counts items in *this
- container::count(key)
  ...counts items in *this that match <key>

All we're doing is making the predicate optional (with an omitted
predicate meaning "always"). I fail to see how this is in any way
whatsoever confusing. (Compare to using "size" to sometimes mean memory
size in bytes and sometimes mean number of elements...)

-- 
Matthew

-- 

--- 
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/.

.
