220 13657 <CAGNvRgB1jYFoq1cMqvFMJJqEfd+UEe0T4qi6UA+LHyhOuAJ_kw@mail.gmail.com> article
Path: news.gmane.org!not-for-mail
From: =?ISO-8859-1?Q?Daniel_Kr=FCgler?= <daniel.kruegler@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Generic std::size, a la std::begin
Date: Sat, 4 Oct 2014 14:21:15 +0200
Lines: 48
Approved: news@gmane.org
Message-ID: <CAGNvRgB1jYFoq1cMqvFMJJqEfd+UEe0T4qi6UA+LHyhOuAJ_kw@mail.gmail.com>
References: <8808df5e-62c4-459d-acd9-00e63adb9476@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
X-Trace: ger.gmane.org 1412428504 985 80.91.229.3 (4 Oct 2014 13:15:04 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sat, 4 Oct 2014 13:15:04 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCT7RVFA4QORBPGMX6QQKGQE72GWRQQ@isocpp.org Sat Oct 04 15:15:00 2014
Return-path: <std-proposals+bncBCT7RVFA4QORBPGMX6QQKGQE72GWRQQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-wg0-f69.google.com ([74.125.82.69])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCT7RVFA4QORBPGMX6QQKGQE72GWRQQ@isocpp.org>)
	id 1XaPAp-0008UE-Sx
	for gclcip-std-proposals@m.gmane.org; Sat, 04 Oct 2014 15:14:59 +0200
Original-Received: by mail-wg0-f69.google.com with SMTP id b13sf1547388wgh.4
        for <gclcip-std-proposals@m.gmane.org>; Sat, 04 Oct 2014 06:14:59 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:mime-version:in-reply-to:references:date
         :message-id:subject:from: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=nZL+SCst6Lux6Nlvo3NyqdGT37Gsnw+fAdrnHcr0AFE=;
        b=R2v4STXcxAos0OZIm4yQFRNuRJsccLsoRNfHu7HEwuJUtJsgGftTxnlXHYXAzLJHSo
         gg6mMzMU3yok4Udg84wGrw0NcvneKkxv7EIzUIvxoTDx6AQ2u+6ZbQ+Lxt/n1hTl/FTI
         +UrrdRys84JYBwkGQip0IkiO8F1JZV96kHIFnl4Eumio+X0QrpIsLHewjxGiCEyQ10Qk
         erF+kQ9VtDP7/QHftUEjSGnoF1i0x//+4VL+0DSlQ+6OmVLC7gfxgCKKbMFihBfjo7gs
         LtaYkU7KS3krxnnEOmnDBQMLU8PqSruwjDq/Lmzgn2FERHpfBIHNGHyMbhBSpnssZsaT
         a9MA==
X-Gm-Message-State: ALoCoQmho55LNKRgUmIFvj60tw5XbgLJxQmnEquQtinkugvl3JxPuRxwktFbg9y8jBvr+M+1IxxO
X-Received: by 10.180.106.197 with SMTP id gw5mr737678wib.1.1412425277573;
        Sat, 04 Oct 2014 05:21:17 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.180.85.73 with SMTP id f9ls331612wiz.14.canary; Sat, 04 Oct
 2014 05:21:16 -0700 (PDT)
X-Received: by 10.180.21.227 with SMTP id y3mr5441306wie.54.1412425276015;
        Sat, 04 Oct 2014 05:21:16 -0700 (PDT)
Original-Received: from mail-wi0-x231.google.com (mail-wi0-x231.google.com [2a00:1450:400c:c05::231])
        by mx.google.com with ESMTPS id mw7si4891109wic.87.2014.10.04.05.21.15
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Sat, 04 Oct 2014 05:21:16 -0700 (PDT)
Received-SPF: pass (google.com: domain of daniel.kruegler@gmail.com designates 2a00:1450:400c:c05::231 as permitted sender) client-ip=2a00:1450:400c:c05::231;
Original-Received: by mail-wi0-f177.google.com with SMTP id fb4so989856wid.4
        for <std-proposals@isocpp.org>; Sat, 04 Oct 2014 05:21:15 -0700 (PDT)
X-Received: by 10.194.232.232 with SMTP id tr8mr14782990wjc.21.1412425275495;
 Sat, 04 Oct 2014 05:21:15 -0700 (PDT)
Original-Received: by 10.216.187.4 with HTTP; Sat, 4 Oct 2014 05:21:15 -0700 (PDT)
In-Reply-To: <8808df5e-62c4-459d-acd9-00e63adb9476@isocpp.org>
X-Original-Sender: daniel.kruegler@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of daniel.kruegler@gmail.com designates 2a00:1450:400c:c05::231 as
 permitted sender) smtp.mail=daniel.kruegler@gmail.com;       dkim=pass
 header.i=@gmail.com;       dmarc=pass (p=NONE dis=NONE) header.from=gmail.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:13657
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/13657>

2014-10-01 10:00 GMT+02:00 Jeaye Wilkerson <contact@jeaye.com>:
> Folks,
>
> The stdlib could use a few new function templates to aid in creating generic
> interfaces. With C++11, we were given std::begin to account for the fact
> that C-style arrays are valid containers. I propose we add a very similar
> set of functions of accessing the size of containers, including C-style
> arrays. The interface is as follows:
>
> template <typename T>
>
> auto size(T &c);
> template <typename T>
> auto size(T const &c);
> template <typename T, std::size_t N>
> std::size_t constexpr size(T (&arr)[N]);
>
> A working implementation and some example code is included here:
> http://coliru.stacked-crooked.com/a/a321818e19f0efae
>
> The two main benefits of this addition are as follows:
>
> Support for C-style arrays in generic implementations; this also makes the
> std::xxx_n series more compatible with C-style arrays
> Allowance of user-provided fully specialized versions of std::size for
> custom types
>
> An example of 2 being: http://coliru.stacked-crooked.com/a/12c71f9970e37463

Have you looked at the existing proposal:

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4017.htm

and if so what is the difference of your proposal?

I should add that for the upcoming mailing deadline a revision of this
proposal has already been submitted, so this is ongoing work.

- Daniel

-- 

--- 
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/.

.
