220 2731 <8d57e9e9-e4cc-441c-abeb-e6526531fad5@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: =?UTF-8?Q?Andrzej_Krzemie=C5=84ski?= <akrzemi1@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: optional references -- take 2
Date: Mon, 4 Feb 2013 11:23:07 -0800 (PST)
Lines: 158
Approved: news@gmane.org
Message-ID: <8d57e9e9-e4cc-441c-abeb-e6526531fad5@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; 
	boundary="----=_Part_408_17593010.1360005787933"
X-Trace: ger.gmane.org 1360005793 13175 80.91.229.3 (4 Feb 2013 19:23:13 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Mon, 4 Feb 2013 19:23:13 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDT2DGOJ34DBBHMVYCEAKGQEI5TZIAA@isocpp.org Mon Feb 04 20:23:34 2013
Return-path: <std-proposals+bncBDT2DGOJ34DBBHMVYCEAKGQEI5TZIAA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-gg0-f197.google.com ([209.85.161.197])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDT2DGOJ34DBBHMVYCEAKGQEI5TZIAA@isocpp.org>)
	id 1U2RdZ-0002sU-Kw
	for gclcip-std-proposals@m.gmane.org; Mon, 04 Feb 2013 20:23:29 +0100
Original-Received: by mail-gg0-f197.google.com with SMTP id k5sf1207748ggn.0
        for <gclcip-std-proposals@m.gmane.org>; Mon, 04 Feb 2013 11:23:10 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=x-received:x-beenthere:x-received:date:from:to:message-id:subject
         :mime-version:x-original-sender:reply-to:precedence:mailing-list
         :list-id:x-google-group-id:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe:content-type;
        bh=xJNPNie7E3WwbVGbrfF1tXa1JNoqGosaC8OrSFc8X2g=;
        b=elnEJCPQGPzH1dk//7nsgt9i20qWPdyos0JeqnkH27AZ4TPQYklKcBtWSEP1AJdEXx
         70BPGwrNMakrZ77KyY9Y3/42NWCdGkmitCZi/BETQUCvV/0IEQZCRKG2dAb87w06Gw41
         D2hnRYctsYHs10MG9y+yg9Xet49fg0XUwc06K4wm8XzmUKvtGHMpYcGpuA3GJX9YEO9w
         VuMY0e5KK4pJP1GwBk+uqfrG2aGpmd+CTxvllbpLX1nwOn7deTfeL6p7UBVq8g5TwBdn
         FSuE9SIcKJI2M6ru8ei02KrdqscZbMIkvrTeFdl7hMsGYwQVcF0kMjVu8rOZ80xdwc9b
         yLBA==
X-Received: by 10.236.81.80 with SMTP id l56mr9050972yhe.16.1360005790384;
        Mon, 04 Feb 2013 11:23:10 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.49.16.37 with SMTP id c5ls1895819qed.80.gmail; Mon, 04 Feb
 2013 11:23:08 -0800 (PST)
X-Received: by 10.49.39.99 with SMTP id o3mr1831520qek.14.1360005788154;
        Mon, 04 Feb 2013 11:23:08 -0800 (PST)
X-Original-Sender: akrzemi1@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:2731
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/2731>

------=_Part_408_17593010.1360005787933
Content-Type: text/plain; charset=ISO-8859-1


>
> > I wanted to consult with people here one more thing about mixed relops. 
> > Assuming that we allow mixed relops for optional values, should we also 
> > provide them for optional references? 
> > 
> > int i = 9; 
> > optional<int&> oi = i; 
> > return oi == i; // should it work? 
> > 
>
> Just to be clear, does it compare the values, or the ref? 
>

The values.
 

>
> ie 
>
> int i = 9; 
> optional<int&> oi = i; 
> int j = 9; 
> return oi == j;  // also true? 
>

This returns true.
 

>
>
> And does this follow whichever rules of set-the-value or set-the-ref 
> you are choosing? 
>
> ... 
> j = 5; 
> oi = j; 
>

mixed assignment is illegal. Use one of the following instead:

*oi = j; // if you want to alter the referred-to object
oi = {j}; // if you want to rebind a reference
 

>
> cout << i;  // prints... 5? 9? 
>

Copy constructor and copy assignment are shallow: they only (re)bind a 
reference. Other operations are deep: this includes comparison (mixed or 
homogenous)
 

>
>
> Sorry to bring up the optional & discussion again.  I really just 
> wondered whether it was consistent with assignment, whichever way it 
> goes. 


I started another thread, in case people want to comment on optional 
references. You can find the updated proposal here: 
http://kojot.sggw.waw.pl/~akrzemi1/optional/tr2.optional.proposal.html
Optional references are at the end as an auxiliary proposal.

Regards,
&rzej 

-- 

--- 
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/?hl=en.



------=_Part_408_17593010.1360005787933
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<blockquote style=3D"margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(=
204, 204, 204); padding-left: 1ex;" class=3D"gmail_quote">&gt; I wanted to =
consult with people here one more thing about mixed relops.
<br>&gt; Assuming that we allow mixed relops for optional values, should we=
 also
<br>&gt; provide them for optional references?
<br>&gt;
<br>&gt; int i =3D 9;
<br>&gt; optional&lt;int&amp;&gt; oi =3D i;
<br>&gt; return oi =3D=3D i; // should it work?
<br>&gt;
<br>
<br>Just to be clear, does it compare the values, or the ref?
<br></blockquote><div><br>The values.<br>&nbsp;<br></div><blockquote style=
=3D"margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); p=
adding-left: 1ex;" class=3D"gmail_quote">
<br>ie
<br><div class=3D"GAK2G4EDN5">
<br>int i =3D 9;
<br>optional&lt;int&amp;&gt; oi =3D i;
<br></div>int j =3D 9;
<br>return oi =3D=3D j; &nbsp;// also true?
<br></blockquote><div><br>This returns true.<br>&nbsp;<br></div><blockquote=
 style=3D"margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 2=
04); padding-left: 1ex;" class=3D"gmail_quote">
<br>
<br>And does this follow whichever rules of set-the-value or set-the-ref
<br>you are choosing?
<br>
<br>...
<br>j =3D 5;
<br>oi =3D j;
<br></blockquote><div><br>mixed assignment is illegal. Use one of the follo=
wing instead:<br><br>*oi =3D j; // if you want to alter the referred-to obj=
ect<br>oi =3D {j}; // if you want to rebind a reference<br>&nbsp;<br></div>=
<blockquote style=3D"margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(=
204, 204, 204); padding-left: 1ex;" class=3D"gmail_quote">
<br>cout &lt;&lt; i; &nbsp;// prints... 5? 9?
<br></blockquote><div><br>Copy constructor and copy assignment are shallow:=
 they only (re)bind a reference. Other operations are deep: this includes c=
omparison (mixed or homogenous)<br>&nbsp;<br></div><blockquote style=3D"mar=
gin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-=
left: 1ex;" class=3D"gmail_quote">
<br>
<br>Sorry to bring up the optional &amp; discussion again. &nbsp;I really j=
ust
<br>wondered whether it was consistent with assignment, whichever way it
<br>goes.
</blockquote><div><br>I started another thread, in case people want to comm=
ent on optional references. You can find the updated proposal here: http://=
kojot.sggw.waw.pl/~akrzemi1/optional/tr2.optional.proposal.html<br>Optional=
 references are at the end as an auxiliary proposal.<br><br>Regards,<br>&am=
p;rzej <br></div>

<p></p>

-- <br />
&nbsp;<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
&nbsp;<br />
&nbsp;<br />

------=_Part_408_17593010.1360005787933--

.
