220 7022 <CAFk2RUbh7yMESeYFRFr+OiEz4FK_EPv+4dUSzA3UDWQbyz+hQw@mail.gmail.com> article
Path: news.gmane.org!not-for-mail
From: Ville Voutilainen <ville.voutilainen@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: More converting constructors for Optional
Date: Sat, 5 Oct 2013 20:33:01 +0300
Lines: 106
Approved: news@gmane.org
Message-ID: <CAFk2RUbh7yMESeYFRFr+OiEz4FK_EPv+4dUSzA3UDWQbyz+hQw@mail.gmail.com>
References: <417ebcd9-ff0b-49d8-b055-bd098e97dddc@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary=001a11c379ec89752804e801cfef
X-Trace: ger.gmane.org 1380994382 23685 80.91.229.3 (5 Oct 2013 17:33:02 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sat, 5 Oct 2013 17:33:02 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBC5JHI7A7ALRBTU2YGJAKGQE37NV2HY@isocpp.org Sat Oct 05 19:33:06 2013
Return-path: <std-proposals+bncBC5JHI7A7ALRBTU2YGJAKGQE37NV2HY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-we0-f200.google.com ([74.125.82.200])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBC5JHI7A7ALRBTU2YGJAKGQE37NV2HY@isocpp.org>)
	id 1VSVix-0003Di-9m
	for gclcip-std-proposals@m.gmane.org; Sat, 05 Oct 2013 19:33:03 +0200
Original-Received: by mail-we0-f200.google.com with SMTP id u57sf4474243wes.7
        for <gclcip-std-proposals@m.gmane.org>; Sat, 05 Oct 2013 10:33:03 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=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=cAva3ClaFmbmffum93flJA87xx8oEcckofjPcixrSZY=;
        b=UfxPhORwpyfBfNYOP1jRBFn2U070QABHP0brA/Z/Y4LpDPlnbiPhpeBhgz0FkMf/TH
         M66TJoOkiIMsFVRMDClceJ7ShpJI82eUUvPKjIrcQWKvRdauhgNK90gw2fQxi7SqAB6p
         lB61SklJZkix+nrbJKj0nZw8QzxJQm6YURUnIfRsPA0t+sTvBEyAmOG576EnAyXJfU0T
         mUE0aphbt/9NMyYlD11l6/zOnBQgC/w0ZY8RJdhtQBuJeOe0Ckyf+SFpOjRwwyDnq5F1
         tdVGX1ZrIs1klMvWGX/PVC3iDusUC7OyINNIi8n3NI/FqEzzNYdveknUe7V2tCkX5IZl
         zXxg==
X-Received: by 10.180.14.194 with SMTP id r2mr5732506wic.0.1380994383011;
        Sat, 05 Oct 2013 10:33:03 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.180.205.6 with SMTP id lc6ls602385wic.25.gmail; Sat, 05 Oct
 2013 10:33:01 -0700 (PDT)
X-Received: by 10.204.168.197 with SMTP id v5mr18658803bky.24.1380994381774;
        Sat, 05 Oct 2013 10:33:01 -0700 (PDT)
Original-Received: from mail-lb0-x230.google.com (mail-lb0-x230.google.com [2a00:1450:4010:c04::230])
        by mx.google.com with ESMTPS id lk6si3136118bkb.213.1969.12.31.16.00.00
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Sat, 05 Oct 2013 10:33:01 -0700 (PDT)
Received-SPF: pass (google.com: domain of ville.voutilainen@gmail.com designates 2a00:1450:4010:c04::230 as permitted sender) client-ip=2a00:1450:4010:c04::230;
Original-Received: by mail-lb0-f176.google.com with SMTP id y6so4311055lbh.35
        for <std-proposals@isocpp.org>; Sat, 05 Oct 2013 10:33:01 -0700 (PDT)
X-Received: by 10.112.89.100 with SMTP id bn4mr17203635lbb.16.1380994381343;
 Sat, 05 Oct 2013 10:33:01 -0700 (PDT)
Original-Received: by 10.112.89.229 with HTTP; Sat, 5 Oct 2013 10:33:01 -0700 (PDT)
In-Reply-To: <417ebcd9-ff0b-49d8-b055-bd098e97dddc@isocpp.org>
X-Original-Sender: ville.voutilainen@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of ville.voutilainen@gmail.com designates 2a00:1450:4010:c04::230 as
 permitted sender) smtp.mail=ville.voutilainen@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: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:7022
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/7022>

--001a11c379ec89752804e801cfef
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On 5 October 2013 20:14, Andrzej Krzemie=C5=84ski <akrzemi1@gmail.com> wrot=
e:

>
> (because this would turn an explicit conversion into an implicit one).
> Such "conditionally explicit" converting constructor is doable, but I run
> on another problem. The additional constructors would look like:
>
> *  template <class U>
> *
> *  optional::optional(U&& u);
>
> *
> *  template <class U>
> *
> *  optional::optional(optional<U> const& ou);*
>
> Suppose you have the following class:
>
>  * struct Port
>   {
> *
> *    Port (optional<int> oi);
>   };
> *
> *
> *
> *  optional<int> oi;
> *
> *  optional<Port> op =3D oi;*
>
> which of the two constructors would the user expect to be called? I guess
> the former, but he would be surprised. I do not know how to solve this
> problem. Perhaps someone on the list does.
>
>
Depends on the user. Advanced users will know that the universal-reference
ctor is a better
match since there's no const involved. Perhaps you could SFINAE it out in
case the incoming
type is optional<U>?

--=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/.

--001a11c379ec89752804e801cfef
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><div class=3D"gmail_extra"><br><br><div class=3D"gmail=
_quote">On 5 October 2013 20:14, Andrzej Krzemie=C5=84ski <span dir=3D"ltr"=
>&lt;<a href=3D"mailto:akrzemi1@gmail.com" target=3D"_blank">akrzemi1@gmail=
..com</a>&gt;</span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div><div><div><br></div>(b=
ecause
 this would turn an explicit conversion into an implicit one). Such=20
&quot;conditionally explicit&quot; converting constructor is doable, but I =
run on=20
another problem. The additional constructors would look like:<br><br></div>=
<div><b>=C2=A0 template &lt;class U&gt;<br></b></div><div><b>=C2=A0 optiona=
l::optional(U&amp;&amp; u);<br><br></b></div><div><b>=C2=A0 template &lt;cl=
ass U&gt;<br>
</b></div><div><b>=C2=A0 optional::optional(optional&lt;U&gt; const&amp; ou=
);</b><br></div><div><br></div><div>Suppose you have the following class:<b=
r><br></div><div>=C2=A0<b> struct Port<br>=C2=A0 {<br></b></div><div><b>=C2=
=A0=C2=A0=C2=A0 Port (optional&lt;int&gt; oi);<br>
=C2=A0 };=C2=A0 <br></b></div><div><b><br></b></div><div><b>=C2=A0 optional=
&lt;int&gt; oi;<br></b></div><b>=C2=A0 optional&lt;Port&gt; op =3D oi;</b><=
br><br></div>which
 of the two constructors would the user expect to be called? I guess the
 former, but he would be surprised. I do not know how to solve this=20
problem. Perhaps someone on the list does.<br><br></div></blockquote><div><=
br></div><div>Depends on the user. Advanced users will know that the univer=
sal-reference ctor is a better<br>match since there&#39;s no const involved=
.. Perhaps you could SFINAE it out in case the incoming<br>
</div><div>type is optional&lt;U&gt;? <br></div></div><br></div></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/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--001a11c379ec89752804e801cfef--

.
