220 2756 <CAOHCbitsUQk2zq1Z0LaU_g2p7=o-U08QSB4x=6VZ4pC-y4DPZw@mail.gmail.com> article
Path: news.gmane.org!not-for-mail
From: Tony V E <tvaneerd@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: optional references -- take 2
Date: Wed, 6 Feb 2013 17:48:58 -0500
Lines: 67
Approved: news@gmane.org
Message-ID: <CAOHCbitsUQk2zq1Z0LaU_g2p7=o-U08QSB4x=6VZ4pC-y4DPZw@mail.gmail.com>
References: <8d57e9e9-e4cc-441c-abeb-e6526531fad5@isocpp.org>
	<CAOHCbiuw0zezce9kcXVsEcE=mPmp=93zQHSRMzUcNw6u3TCsBQ@mail.gmail.com>
	<ca43f129-cd55-43d3-89fc-1e4402af0e9f@isocpp.org>
	<CAOHCbivkX3wbRi6dTAcpZ1EmbpOjx_h6VkCqN8KHT0mZ_UWUXQ@mail.gmail.com>
	<13f19963-066b-4170-a6f2-eb90bed29be1@isocpp.org>
	<CAOHCbitBc-bgxOgMZwDqKeK_LAm8NV3HjEnZwA=qeKkYC0KXkw@mail.gmail.com>
	<f5537c87-285f-4b18-a8a3-2ddf80bf2230@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
Content-Transfer-Encoding: quoted-printable
X-Trace: ger.gmane.org 1360190940 13968 80.91.229.3 (6 Feb 2013 22:49:00 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Wed, 6 Feb 2013 22:49:00 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCUZ5QWKNQINZO6LRACRUBBTQWT42@isocpp.org Wed Feb 06 23:49:19 2013
Return-path: <std-proposals+bncBCUZ5QWKNQINZO6LRACRUBBTQWT42@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-wg0-f71.google.com ([74.125.82.71])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCUZ5QWKNQINZO6LRACRUBBTQWT42@isocpp.org>)
	id 1U3Dnr-0006o7-8Q
	for gclcip-std-proposals@m.gmane.org; Wed, 06 Feb 2013 23:49:19 +0100
Original-Received: by mail-wg0-f71.google.com with SMTP id dr13sf1903550wgb.10
        for <gclcip-std-proposals@m.gmane.org>; Wed, 06 Feb 2013 14:49:00 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=x-received:x-beenthere:x-received:x-received:received-spf
         :mime-version:x-received:in-reply-to:references:date:message-id
         :subject:from:to:x-original-sender:x-original-authentication-results
         :reply-to:precedence:mailing-list:list-id:x-google-group-id
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe
         :content-type:content-transfer-encoding;
        bh=LMhxQhm51H7PoXLmP7LKIDlx3Ex0g9TF3WEJ0qsXQS4=;
        b=nWyBF0GK8yxrIetlE86qKbqicQVuLatQGXWJdjS44Up04o6Bs+ZMq/yKun1Ofqm8Dh
         EaR+Frobn0d3FsaD4t7O2PwbjZvKW5QYWW4reBK3kaOB5oTe77r1SLlKYlvhENB/7bmC
         K+yX+dBZiPBWfhHPT68MmffUBsXPpSiKFLrVDlG5FUiU8ZO3n2Gpwu/o5mh4JONw9FeC
         GnE/wvjTMfsrR+pwgIvDAertkpZekoNQzI7kBUFVYFsoUy4z62ilmQBBkDKbfurI8gw5
         opAUW8LvJYMjhnwcr1Pn1I1 
X-Received: by 10.152.47.211 with SMTP id f19mr5625625lan.4.1360190940255;
        Wed, 06 Feb 2013 14:49:00 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.152.46.206 with SMTP id x14ls35712lam.109.gmail; Wed, 06 Feb
 2013 14:48:59 -0800 (PST)
X-Received: by 10.112.87.105 with SMTP id w9mr11299724lbz.14.1360190939514;
        Wed, 06 Feb 2013 14:48:59 -0800 (PST)
X-Received: by 10.112.87.105 with SMTP id w9mr11299722lbz.14.1360190939491;
        Wed, 06 Feb 2013 14:48:59 -0800 (PST)
Original-Received: from mail-la0-x229.google.com ([2a00:1450:4010:c03::229])
        by mx.google.com with ESMTPS id w7si11066363lba.143.2013.02.06.14.48.59
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Wed, 06 Feb 2013 14:48:59 -0800 (PST)
Received-SPF: pass (google.com: domain of tvaneerd@gmail.com designates 2a00:1450:4010:c03::229 as permitted sender) client-ip=2a00:1450:4010:c03::229;
Original-Received: by mail-la0-f41.google.com with SMTP id fo12so1983095lab.14
        for <std-proposals@isocpp.org>; Wed, 06 Feb 2013 14:48:59 -0800 (PST)
X-Received: by 10.152.114.42 with SMTP id jd10mr28256086lab.31.1360190939128;
 Wed, 06 Feb 2013 14:48:59 -0800 (PST)
Original-Received: by 10.112.14.75 with HTTP; Wed, 6 Feb 2013 14:48:58 -0800 (PST)
In-Reply-To: <f5537c87-285f-4b18-a8a3-2ddf80bf2230@isocpp.org>
X-Original-Sender: tvaneerd@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of tvaneerd@gmail.com designates 2a00:1450:4010:c03::229 as permitted
 sender) smtp.mail=tvaneerd@gmail.com;       dkim=pass header.i=@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?hl=en>,
 <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?hl=en&topic=25838>,
 <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en>
List-Subscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe?hl=en>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe?hl=en>,
 <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:2756
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/2756>

On Wed, Feb 6, 2013 at 3:08 PM, Andrzej Krzemie=C5=84ski <akrzemi1@gmail.co=
m> wrote:
>
>> >>
>
> Let me just add one observation about mixed assignment. There is always t=
his
> case where you are assigning to a disengaged optional reference. In that
> case assigning value is not possible because there is nothing to assign i=
t
> to, so you have to rebind the reference. This makes the mixed assignment
> behave like assign_nonrebind():
>
> void assign_norebind(optional<T&>& optref, T& obj)
> {
>    if (optref) *optref =3D obj;
>    else        optref.emplace(obj);
> }
>
> Which, as you observed, "is 2 totally different semantics ('targetting' v=
s
> 'set-value-of-target') rolled into one."
>

Yes, I was thinking about that after hitting 'send'.  Note then that:

optional<int &> oi; // disengaged
oi =3D 123; //fails - how? exception?
oi =3D j; //works, binds

And oi =3D j has completely different meaning when oi is engaged vs not.
 Whereas that is not true for other optionals.

Or I guess maybe it is true.  Any optional<N> even for N that is
NonRegular has the same assign semantics, right? ie

>    if (optref) *optref =3D obj;
>    else        optref.emplace(obj);

ie call assign, else call constructor.

It is just that for RegularTypes, those are the same thing:

T a; a =3D b;  <=3D=3D> T a =3D b;

But for NonRegular types, particularly references, it may not be the
same.  I just find it scary on references.  ...Which brings us back to
why you disabled it.  Yet you are only disabling it for references,
not for all NonRegular types.  So maybe you shouldn't special case
references.  If you put any NonRegular types into optional, you get
what you expect/deserve.(?)

Tony

--=20

---=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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/?hl=3Den.



.
