220 41481 <1e6e2f7e-cc29-7f39-f421-3674cd71ce14@gmail.com> article
Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail
From: Matthew Woehlke <mwoehlke.floss@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Allow array as function return value
Date: Wed, 20 Feb 2019 14:33:38 -0500
Approved: news@gmane.org
Message-ID: <1e6e2f7e-cc29-7f39-f421-3674cd71ce14@gmail.com>
References: <e1c07ac6-73d0-40c8-98a0-60a5c8a6c575@isocpp.org>
 <CAM76qmtaaQtCP_+f5Z6B3jCsruZVzSR7Q6ezcVX=zMSjq4ujcQ@mail.gmail.com>
 <8a165c32-718a-4247-93b4-44235a2cf122@isocpp.org>
 <f870e6c5-4cb2-47f8-d963-363e68626841@gmail.com>
 <65d69c2c-3fa1-40a5-8120-53bfd345ac90@isocpp.org>
 <7eac0e9f-4042-45d6-93b3-de89ba4ebae0@isocpp.org>
Reply-To: std-proposals@isocpp.org
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226";
	logging-data="32073"; mail-complaints-to="usenet@blaine.gmane.org"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101
 Thunderbird/60.4.0
To: std-proposals@isocpp.org, Nicol Bolas <jmckesson@gmail.com>
Original-X-From: std-proposals+bncBC37LBFWUIFBBFGXW3RQKGQETOD7G6Y@isocpp.org Wed Feb 20 20:33:43 2019
Return-path: <std-proposals+bncBC37LBFWUIFBBFGXW3RQKGQETOD7G6Y@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-qk1-f198.google.com ([209.85.222.198])
	by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
	(Exim 4.89)
	(envelope-from <std-proposals+bncBC37LBFWUIFBBFGXW3RQKGQETOD7G6Y@isocpp.org>)
	id 1gwXck-0008El-Hr
	for gclcip-std-proposals@m.gmane.org; Wed, 20 Feb 2019 20:33:42 +0100
Original-Received: by mail-qk1-f198.google.com with SMTP id n197sf3463590qke.0
        for <gclcip-std-proposals@m.gmane.org>; Wed, 20 Feb 2019 11:33:42 -0800 (PST)
ARC-Seal: i=2; a=rsa-sha256; t=1550691221; cv=pass;
        d=google.com; s=arc-20160816;
        b=igYKHK7/Ny2Y5vOoead/I4WpnTsa+GArG8X08WprKIsL/hPqu7mzGFzS4+O7mJSnqf
         dT9Da88qjrAfz8FW/2gNql7Ey1mCnpj++2JLpQn9259+cf/2xeCqDJS14CqBIeYZfUxM
         a1bOjWzdmwZSUfgPig0fbC8wuNeG7bW0BbICHllE4Le2snv8IexD9sT6LbUbYObTc+gf
         8nMPlGttvTaIlxuH3KpG1hTeml3LND1alnZCeMFIABEEIUcKeKdmNyQwAJ48jWayctK5
         rjJaNSOPfXLzd7xg3bRZGaKzE8pJLXSA+KT1HLArLrJmADPqNhA818W1m2NX1vjq1pIK
         XIWQ==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
         :list-id:mailing-list:precedence:reply-to:content-language
         :in-reply-to:mime-version:user-agent:date:message-id:openpgp:from
         :references:to:subject:dkim-signature;
        bh=0I2o3z/2mD3/71sA+hBMoD9Tpi3rz04OpcM988zFhSE=;
        b=ENb1ZY3lxTGi2hLjR/+dFYu4E3aQjpaS3wRv+4xy/E97U9b+RUuIMBOekbYw8A+tz1
         axoHmWaIlmN6GBhzQ4KCP5ghiPi+gYvyExWx5qSmz+OxpFcX6Z3RQ4XkCJm72sSxZrCn
         hvSk3MpQVu/8OkniAp4ttfFsZ/jyg5n0BaxdNMmYfzV3nre0OQP6C6kDK/r3xoJyxVv5
         QvP+6PAaQpwoioT36oNGIkqlIEDIKC7msF4+1rvFls/NfvDpbTtRQvWhFBnKK0hQ0Uf0
         2eE6wTIOes8wyqCivnQu5OBq5/dvFegFU2sdYowXuPnrrkJ3xiSW4bllnKs+mgFMNQcj
         fQdg==
ARC-Authentication-Results: i=2; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b="NCiE7/jm";
       spf=pass (google.com: domain of mwoehlke.floss@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=mwoehlke.floss@gmail.com;
       dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=subject:to:references:from:openpgp:message-id:date:user-agent
         :mime-version:in-reply-to:content-language: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=0I2o3z/2mD3/71sA+hBMoD9Tpi3rz04OpcM988zFhSE=;
        b=YnCtATZ13zYhEyzJhuVPYwmkFr4CpOVS0cwzDco+58amv4ZvP6blrpJg2Cd2WYhUPt
         0qk3O8afayZR5XEADf1cWnwl3zZcCp1u0WiGYCUg/kxW2KYUYuVAZh21jf4vsD+aAtWJ
         2iVvsQ1TFi9OymGTeUO/aZdEFtxn+VHSfhELJUNtGe/o1N5hAfGYIns7mK33j5BaEyja
         cNQsGBedYLtSaDHs1WR0V/GR5/3Y1CfYPjNY5PJGojJpu3NbKWPI5izw5i1ZadticP/3
         ZNXx6lWwUcCkv138uqGJQy6qtSGuv8bDgTPm/pjdHFp66xnzQJb2ZGAj0U7mxwVx9nve
         AOxg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:subject:to:references:from:openpgp:message-id
         :date:user-agent:mime-version:in-reply-to:content-language
         :x-original-sender:x-original-authentication-results:reply-to
         :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post
         :list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=0I2o3z/2mD3/71sA+hBMoD9Tpi3rz04OpcM988zFhSE=;
        b=qvFMvt926uuG7uaytlLbQxT3C22KhRGZvqZFniidPHPNcbP3Xwu5FZYA65tUI8L5R/
         iLmb2XHHckzgKZt1u7jrN3qEvmpBzoB9PEW3ESf+SbuD6kW9VE1+E2SOxzQ48Jaq5u//
         bzlPnoFrXjHGSAKMUmFBz1DvQacBu/YH7W6wcySy3xjBva/0gVvmVOtiEM2kAYL/6A4d
         vj0Dy1IFQOS+OIOJ8BRUIYYzqvzE3xE8QzBGIwvSkPAfhlQIMGDp/1Rkn39VVXJOr2o7
         XuH4EkrVhnyBh66uDP/3Mc9nb8/tnWtPuYw+UAxlScwgvMfigdY/zbEQczoZV2KeYAcc
X-Gm-Message-State: AHQUAubXDl18raYeAIhiSgt/l+s6CjEAPkqbbiEKhUmTe+a85o3SRl9R
	bNaofdjqtVA6hAKX53Apun1nxA==
X-Google-Smtp-Source: AHgI3IZWU/84qDBYSOeMi3O5NRy2A5nDhTIhQljjEIdz6fMc8LK09r6U4Sgb8iKh8rMDYJV3uiYokQ==
X-Received: by 2002:aed:3525:: with SMTP id a34mr20526071qte.42.1550691221016;
        Wed, 20 Feb 2019 11:33:41 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 2002:a37:3841:: with SMTP id f62ls11246qka.1.gmail; Wed, 20 Feb
 2019 11:33:39 -0800 (PST)
X-Received: by 2002:a37:9d96:: with SMTP id g144mr26352106qke.192.1550691219846;
        Wed, 20 Feb 2019 11:33:39 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1550691219; cv=none;
        d=google.com; s=arc-20160816;
        b=R0aLjd10crrs9oJRzOx0pFMkNtyrC4IvggocCYOy9NdJyptdD+bV+9sVYcFbvAYi1+
         GgAQed23ZqqRNIr3D7pRZe6k3hV2sLhUKoL/mHvV92hKATxGayJvMXF1VJOxKSXQ05js
         tA6xjzlfnBsFzNuabgKqCJgFJN0NYTJxrU14/H5W+vpBQxHsbilq9sKh7CcPC+C8Qarh
         /t25ApWdJ/MvryoicYO1NzEzZmCZ/42eA4DJzML8+vGgyFpfYDXFIpIm2OK10eB5yV1l
         B+zhV+JVUtHBTak2wZL9ZCWOcANn2LvXjz8FnTkN407r+Ghy04i26Og8ORMA7fN51s6+
         36/Q==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=content-transfer-encoding:content-language:in-reply-to:mime-version
         :user-agent:date:message-id:openpgp:from:references:to:subject
         :dkim-signature;
        bh=EwZlFO5PkW0OsOViqhzsSZSpfNfFnjxIQaixNyVhd80=;
        b=P7wJffefFHSWaLp8oeO+Kt5crCJf19bZ35TsEGFJ1r1gtmjJGX6UpEgQjEpoQAkXl/
         e32tU3mBF6phPwSwmwhZrnaYH4Yz+ZSG+aPpn9yhDfAeMafsg3ogsWbiF8Rze/cXzPbS
         6pBmhBTzeXXtq1w1WRvH/NgsoSODq+sg1/EiPaT71i2w7HuPdUqEDfXZuX1M2lajx2Qo
         WIGrAgebjGLt/A46kFUPYIsAdWteHWeRH/QRboISO/v44EmFnUNvw/e9hdoQ7N9oWmpb
         /fDkThsWcLzO6eQnDiBKFKzHEMraijEZ5fE2h1DdJz2mewhzHgYrwMWYZxLeVWYeVOYb
         /6tA==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b="NCiE7/jm";
       spf=pass (google.com: domain of mwoehlke.floss@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=mwoehlke.floss@gmail.com;
       dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com
Original-Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41])
        by mx.google.com with SMTPS id z63sor12833759qka.140.2019.02.20.11.33.39
        for <std-proposals@isocpp.org>
        (Google Transport Security);
        Wed, 20 Feb 2019 11:33:39 -0800 (PST)
Received-SPF: pass (google.com: domain of mwoehlke.floss@gmail.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41;
X-Received: by 2002:a37:b142:: with SMTP id a63mr26224883qkf.16.1550691219719;
        Wed, 20 Feb 2019 11:33:39 -0800 (PST)
Original-Received: from gryphon.kitware.com (tripoint.kitware.com. [66.194.253.20])
        by smtp.googlemail.com with ESMTPSA id f7sm12566675qkb.33.2019.02.20.11.33.38
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Wed, 20 Feb 2019 11:33:38 -0800 (PST)
Openpgp: preference=signencrypt
In-Reply-To: <7eac0e9f-4042-45d6-93b3-de89ba4ebae0@isocpp.org>
Content-Language: en-US
X-Original-Sender: mwoehlke.floss@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com header.s=20161025 header.b="NCiE7/jm";       spf=pass
 (google.com: domain of mwoehlke.floss@gmail.com designates 209.85.220.41 as
 permitted sender) smtp.mailfrom=mwoehlke.floss@gmail.com;       dmarc=pass
 (p=NONE sp=QUARANTINE 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: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://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>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:41481
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/41481>

On 19/02/2019 22.55, Nicol Bolas wrote:
> From a more objective POV, my feeling is that `std::array` really only has 
> two significant flaws relative to to C arrays: not being able to omit the 
> size of an array while still specifying the type (which is a matter of 
> CTAD), and the general verbosity of multi-dimensional arrays.

Well, I can help with the second... shortest ever proposal?

  namespace std
  {
    template <typename T, size_t First, size_t... N>
    struct array : array<array<T, N...>, First> {};
  }

Example:

  std::array<int, 5, 3, 4> x;
  x[1][1][1] = 42;

Implementing operator() to do multi-level indexing is left as an
exercise for the reader.

Of course, the reason we don't have this yet is because folks want to
argue about packing order and whatnot. It turns out multi-dimensional
arrays aren't actually as simple as you'd think.

-- 
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.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/1e6e2f7e-cc29-7f39-f421-3674cd71ce14%40gmail.com.

.
