220 35826 <eae7f2ca-01dc-9683-0262-af99abdf7e35@gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: =?UTF-8?Q?Jonathan_M=c3=bcller?= <jonathanmueller.dev@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Output parameters
Date: Sat, 9 Dec 2017 20:50:01 +0100
Lines: 41
Approved: news@gmane.org
Message-ID: <eae7f2ca-01dc-9683-0262-af99abdf7e35@gmail.com>
References: <1c1bb50b-2d59-4247-a158-158065fb1a9a@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"; format=flowed
Content-Transfer-Encoding: quoted-printable
X-Trace: blaine.gmane.org 1512849005 18127 195.159.176.226 (9 Dec 2017 19:50:05 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Sat, 9 Dec 2017 19:50:05 +0000 (UTC)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
 Thunderbird/52.5.0
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCUMHC4Z6QGBB3H4WDIQKGQE3BG3NNY@isocpp.org Sat Dec 09 20:50:01 2017
Return-path: <std-proposals+bncBCUMHC4Z6QGBB3H4WDIQKGQE3BG3NNY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-wr0-f198.google.com ([209.85.128.198])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCUMHC4Z6QGBB3H4WDIQKGQE3BG3NNY@isocpp.org>)
	id 1eNl8I-0004S5-M2
	for gclcip-std-proposals@m.gmane.org; Sat, 09 Dec 2017 20:49:58 +0100
Original-Received: by mail-wr0-f198.google.com with SMTP id f9sf7973446wra.2
        for <gclcip-std-proposals@m.gmane.org>; Sat, 09 Dec 2017 11:50:06 -0800 (PST)
ARC-Seal: i=2; a=rsa-sha256; t=1512849006; cv=pass;
        d=google.com; s=arc-20160816;
        b=LIsRq6SCYF+xKZ/vwbQAjJ8ayD0Pq1MX9IVPE4X0f6Ppa5Bz5D/ukM683O6Uhvesft
         F1VgrpOHgkLzrpbgfzs0OlHE9TiPvg7mqFi2tIpGFI+CrBLy/M7w1C+KbisNFFx6syDN
         RSJnV463NSLhCni24eDLwgUDmEDQ9O145qcHddspHWIDmwbZ2+ogJ9zzssfubsb8gpu+
         FuOLtywaWxlibaTnYz9aq9FSPhh7DR9TCYSEPTdGQLM/Nk0xdBpb/DJ9cSRX6yD/kg81
         pqIBpJaSHJyLq/uMkfQXBnTsz8e/PS4LzSIDDUvXgszvRz6bjyK7c6XlGIRSCvlfqKhk
         a20w==
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-transfer-encoding
         :content-language:in-reply-to:mime-version:user-agent:date
         :message-id:from:references:to:subject:arc-authentication-results
         :arc-message-signature:dkim-signature:arc-authentication-results;
        bh=fX1Ny6Ro/qRmE+Hgw4jmhonlveaSC3RmIT7jSIfcUts=;
        b=t7zzQVXtMXqEiZqZ4o8jLco57MDnsLiFpXxOGU6gJwxjKBAN1HHjeB9bKCzKFt/YgN
         9H5HgOncfH00hQYWv8RvVGg04iEDolgPzCIAsO5+8T+7qjr893tfn0640UDGWgjQE029
         MLDPKrRcli8bZOJbleRWeJNlb42IuTGYSiNB4IYzscfBCxHA/5eDAy7lIOO0uVVgECr1
         BaZAxPYZzGJ2Y3KK6B2q/Iv7qRAdR5kNMNulGcpUlijQqrDRu2PDdrQw8hAhKKz3WiWS
         4NSuSvnU+gCvm54Zt1jtNR97V/n6m9K9jxARs+5iZVG31G3yhUVjzIn6z0F2S3 
ARC-Authentication-Results: i=2; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=JwqQIfVR;
       spf=pass (google.com: domain of jonathanmueller.dev@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jonathanmueller.dev@gmail.com;
       dmarc=pass (p=NONE sp=NONE 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:message-id:date:user-agent:mime-version
         :in-reply-to:content-language:content-transfer-encoding
         :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=fX1Ny6Ro/qRmE+Hgw4jmhonlveaSC3RmIT7jSIfcUts=;
        b=izMp865eI1aoyGZQsHYuv1iwHq6pyyO9tr1aZcr3lay8wGUV41ICPZcPktYCYDLWU/
         WRa+uFkRfJfwn02ht66eqgRTipfb3xF9LWJNEwipP0c3JP6HQbn3ZTgktX2DXUQiJO3c
         6uFzgwwk+5tbtxZ9jlrdh5zWUl1rgy6TdnqCo+McJhHyVS4eYI85copiF0Hrgg615c29
         X33y8mZVDrCnlYWAQBcME4up+CFq5VIvbM6gLEY4aTzitxYfiaJRpQg8ogPqpMGVBpF2
         aNl3up80D5QagG715GPFk4oDqNkJ+GIGlV1SPxq/+EdEeO0ZunkhGrrV4PBd+ma3Ak9y
         dwg 
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:message-id:date
         :user-agent:mime-version:in-reply-to:content-language
         :content-transfer-encoding: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=fX1Ny6Ro/qRmE+Hgw4jmhonlveaSC3RmIT7jSIfcUts=;
        b=Wp/mx5YBn+jlRPHvmC+gCsunNFQKpyF67Q0KxtXSBBNqioCF+ZeJeD/0XOaBcIAy04
         aVbP87nv1PJDcTlb1HUDR+I/EvTVc4iLDQdjye0UpwyWFJD9uhVsce9qIVI1AUkIzxB+
         CAIvvtfkDZnujMoLpAzrXMrkdP8iw5zhyBvYEMbGMneT6KfJx3gyOpwhaqKLJf3w57oO
         KTEshNc9ucG9rD4U1tA1GCdLfd3tWeOZ0WR6Tb+w5z6OBb0kxaNcVlM/EUVgpz5q1xYp
         ryP0e1pJ9OnTGCp+U5ohMX9ntmHFswZZ4K098UTzknU 
X-Gm-Message-State: AKGB3mK5549elNRg/EgwElADYsOmqJwQm9rPAvR1HYXq5BN3toTPjMt4
	8pRgpfgAxkrrkw/Za/v+2osEqw==
X-Google-Smtp-Source: AGs4zMZJ14H2pxm7yXjYRTFKeg1tNqELWBsIPd9RCEjGaeqnSzY9V5+xgeXrolainPf9D6HZC0MKNg==
X-Received: by 10.28.88.207 with SMTP id m198mr1025999wmb.31.1512849006001;
        Sat, 09 Dec 2017 11:50:06 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.28.125.198 with SMTP id y189ls778580wmc.8.canary-gmail; Sat,
 09 Dec 2017 11:50:04 -0800 (PST)
X-Received: by 10.28.129.77 with SMTP id c74mr6932138wmd.124.1512849004169;
        Sat, 09 Dec 2017 11:50:04 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1512849004; cv=none;
        d=google.com; s=arc-20160816;
        b=OTieRzcLUR+uvTdCBPm+CmT8MCjXI+/Eg6fF8fY4qLbNvvZBb4BLG0Fmqsl4Qhi6Hu
         cB+LKIYJ2VYP20mZgPu13F3//2v86dxwtSlTUzgBRsn+87gQYZQZaDfvmaopNgJDdNsD
         SIUHJV94ypU2Rr67xhDfgGpg9dXhOPmxJRbueo6VoJHuG6N79WIbjPLCRLBr1lvmHipx
         kEbz42S7knmJj/oSjGiDDCwO3zpWKPk4FVH5Dj6I7kjYgI9OnISlk3/08HftE5VF0PB8
         iKIkwhgW4uPCIbWwDX0mgm1jQnSXt8KJ+LT5uhADNg0aGBGqZfwEGN6/2BPoYQTnuyW8
         WH2g==
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:from:references:to:subject
         :dkim-signature:arc-authentication-results;
        bh=xPt+B9hqi0bmPRFRgI8pi2Ji6ND+W5qyc8n+N1emJFY=;
        b=yeY7jGpPIFTMoxOVJ2YreUg8lNZF7DZcv7Qm1IS7mff1WP+Ni6mHdkDvnZOe+mamcv
         fCChMYk1vK2tBAE5M4UOVt9tSOWRT980NIgMWgU1B7QCyHJMe+k/dXXme7OXvtw27UWu
         iqbGon7Bs71Dk//pWgLkVCZqBSkEhaeI3zutk71ykYqE32Bu/TRAGJaBnCJCLidEfhyi
         +KFzIGu7bIsnQOKpKD6fhgXIpWxucAvE5u9d7K58B6hhpw/Qhs1zNIYy6Sgp5ckzVdeJ
         2cb7LCEjHdnIX7wGvjqEvN5QGEiVaqOolN69MrlnhP0HqmF6AttSo9g0cGQyTYqttXnE
         8PeQ==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=JwqQIfVR;
       spf=pass (google.com: domain of jonathanmueller.dev@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jonathanmueller.dev@gmail.com;
       dmarc=pass (p=NONE sp=NONE 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 a99sor5063649wrc.4.2017.12.09.11.50.04
        for <std-proposals@isocpp.org>
        (Google Transport Security);
        Sat, 09 Dec 2017 11:50:04 -0800 (PST)
Received-SPF: pass (google.com: domain of jonathanmueller.dev@gmail.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41;
X-Received: by 10.223.193.141 with SMTP id x13mr29206802wre.239.1512849003664;
        Sat, 09 Dec 2017 11:50:03 -0800 (PST)
Original-Received: from [192.168.2.114] (p5B02851D.dip0.t-ipconnect.de. [91.2.133.29])
        by smtp.gmail.com with ESMTPSA id b66sm4545712wmh.32.2017.12.09.11.50.02
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Sat, 09 Dec 2017 11:50:02 -0800 (PST)
In-Reply-To: <1c1bb50b-2d59-4247-a158-158065fb1a9a@isocpp.org>
Content-Language: en-US
X-Original-Sender: jonathanmueller.dev@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com header.s=20161025 header.b=JwqQIfVR;       spf=pass
 (google.com: domain of jonathanmueller.dev@gmail.com designates 209.85.220.41
 as permitted sender) smtp.mailfrom=jonathanmueller.dev@gmail.com;
       dmarc=pass (p=NONE sp=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: <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:35826
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/35826>

On 09.12.2017 20:22, odomobo@gmail.com wrote:
> It would be useful for c++ to have an idiomatic way to express strictly=
=20
> output parameters. This would especially be useful for self-documenting=
=20
> APIs, and would help prevent usage errors with 0 runtime cost.
>=20
> It should be easy to implement using templates. Something like the=20
> following:
>=20
> |
> voidfoo(out_ref<int>o){o =3D10;}
>=20
> voidmain()
> {
> intx;
>  =C2=A0 =C2=A0 foo(x);
>  =C2=A0 =C2=A0 cout <<x <<endl;
> }
> |
>=20
> I've attached my (probably buggy) proof-of-concept.
>=20
> I'm curious why the stl doesn't already have something like this. Was it=
=20
> overlooked, or is there a good reason against having this?
>=20

I covered that topic in depth in this blog post:=20
http://foonathan.net/blog/2016/10/26/output-parameter.html

--=20
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 e=
mail 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/eae7f2ca-01dc-9683-0262-af99abdf7e35%40gmail.com=
..

.
