220 32537 <CAGsORuBi-W4ZjOiBbmPCErmkEVsa1zehi6fRfXr1EJ+=p6meyg@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Zhihao Yuan <zy@miator.net>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: constexpr ternary (was: Re: relaxing rules for
 ternary operator. Allow incompatible types.)
Date: Sat, 20 May 2017 16:01:31 -0500
Lines: 84
Approved: news@gmane.org
Message-ID: <CAGsORuBi-W4ZjOiBbmPCErmkEVsa1zehi6fRfXr1EJ+=p6meyg@mail.gmail.com>
References: <1b5ee8eb-53df-4e98-af2f-829c7bc2e5b2@isocpp.org>
 <9770742d-c5de-4a55-869f-ab71231cc775@isocpp.org> <9dbebffff1732ae5966a93b69a836757@kdab.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="94eb2c0b916c473c5a054ffaf1bc"
X-Trace: blaine.gmane.org 1495314094 25650 195.159.176.226 (20 May 2017 21:01:34 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Sat, 20 May 2017 21:01:34 +0000 (UTC)
To: "std-proposals@isocpp.org" <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCSKRWMD4EHBBLG5QLEQKGQEXGTFAFI@isocpp.org Sat May 20 23:01:29 2017
Return-path: <std-proposals+bncBCSKRWMD4EHBBLG5QLEQKGQEXGTFAFI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-vk0-f69.google.com ([209.85.213.69])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCSKRWMD4EHBBLG5QLEQKGQEXGTFAFI@isocpp.org>)
	id 1dCBVA-0006Wm-Pm
	for gclcip-std-proposals@m.gmane.org; Sat, 20 May 2017 23:01:28 +0200
Original-Received: by mail-vk0-f69.google.com with SMTP id d144sf15495398vka.15
        for <gclcip-std-proposals@m.gmane.org>; Sat, 20 May 2017 14:01:34 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1495314093; cv=pass;
        d=google.com; s=arc-20160816;
        b=j8PqlpMt2HX3za+nQXyEdhK4NyD8ZZibf7BRQZ5jRb8ROdCJ8h3b3IXk1Ziax6d2ba
         h9XiK5oMO/wdGdWLYhlLAqAcSINYC4KVV4W2ZdJHQykmal2CE1aTgDFmUSEOwLTwc0ka
         BsZAo7f649r8z1SNR2nqh+/Sdq6/l7cSAuNqTzk+p3pYnV3Zq8BeywgOaIPShljnjDgR
         QRaawoNHtn6F3Wx41KhKWaVBYQbae5RuAoCy7mmjppK2/f60daXfuoElmAJXX/e962p1
         90sWaJsuAjzt3rMi4PEoDp+MrbTMbCrqMR7xFVdx5mzD6yh3C2JAtgfGQrKt5jFHHhmF
         8EgA==
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:to:subject:message-id:date
         :from:references:in-reply-to:mime-version:sender
         :arc-authentication-results:arc-message-signature
         :arc-authentication-results;
        bh=YZzEmJxh9fEMVrFhy1hLKeJyX8GzsZGKulTYyP6pJt8=;
        b=UqcgF4J2Zn2aRogEZqkPqpkST3bGNKGwkIfIcPPohhxzqvzR1iakjqcGSdYIRQpWw4
         OEOEURIdAvvWBBuzgERysvkpNNmT93MDZjh968i8wi4lOvymZDTxtqwD4oHD+GXB+EkW
         /wJMye0NaHuRc/skDdZTX2CVH7z6xrVZQOUObwn41tV2HjYsHxZgrVcNNtObT4Jd0yLW
         ZI4NCEF2aVChLE8R/v3CiGzqFwH7L3XdcFHAWEyP4SgdoA7lbl9N612isjNAKR4zKEbW
         uTRuf1lE0To2Rmit2jCgtXSYpMqBC2rh3a+v67xYC/1YUAnHUv9wyjHbVsNdRM3o+sgb
         RWmw==
ARC-Authentication-Results: i=2; mx.google.com;
       dkim=pass header.i=@miator.net;
       spf=pass (google.com: domain of bounce+3f9131.69110-std-proposals=isocpp.org@miator.net designates 184.173.153.196 as permitted sender) smtp.mailfrom=bounce+3f9131.69110-std-proposals=isocpp.org@miator.net
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:sender:mime-version:in-reply-to:references:from
         :date:message-id:subject:to: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=YZzEmJxh9fEMVrFhy1hLKeJyX8GzsZGKulTYyP6pJt8=;
        b=NZGbzY8Xk7SteZq1ZEPJHgW6ZdeLDWhgGFBv3aSHzkW6gHZpSuxJa5N+JfM8/X5nJS
         XLCqYDA14dAfPQjD3Rsew+YY50bkJFR+gTBO4MefRdYECCruGYowbCjWDFVmOij+RZG+
         TnWbp/aCmzWrIkoxhifAqixXSH9XNJGYc16vZb6rz92brv+Dhu/VeJYxdZ7vDjp179HL
         MBrxkdci1xaVUXsKBzmmFPm8eOqKsD0uKPWAD8upg/nZaAp5nDR4Xc9QLBWbpJTnNmPt
         jSXp2RF0h+TvFUM5RIzBP1dvm24nDKDLU1/s12V6JqrFhSeBAImcSwZwQOl9q0r0LfUt
         lXqg==
X-Gm-Message-State: AODbwcDuwYw7Bjqz8pc//SMNtQyyrCBBRubzNSVnTkHmTc+fsoAHU7ug
	QC7MIDfMUfEd+NB9
X-Received: by 10.31.160.18 with SMTP id j18mr4115622vke.31.1495314093608;
        Sat, 20 May 2017 14:01:33 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.157.60.102 with SMTP id j35ls1135149ote.13.gmail; Sat, 20 May
 2017 14:01:32 -0700 (PDT)
X-Received: by 10.55.207.140 with SMTP id v12mr14153718qkl.68.1495314092769;
        Sat, 20 May 2017 14:01:32 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1495314092; cv=none;
        d=google.com; s=arc-20160816;
        b=MTwx6HNGyjiUoGj3JP2Uq7z4Vgxgu5wnSGrxBDZXniIZbSp+9ogfIukxPdFuhHH8mU
         2aJnufsF3EoruTu+5vrzim7AlZIGMihHdgeW2DOgYnkBgrmNEctqtmFybQy1YGLIttD1
         ssmuARvFgoa2J9lzm1H17KpR/bCYu38hugi4TcrN3QHMop1auDUW0W0XGF0NP+568jfG
         k9rDW0nQa2H3K53Gx9+1hYED79wQ8PSBBj65tnkuy7Oil94qc+rUAf8/aKg3HivKtCgP
         YSm9fq9DVImDjf5PIny7Wmx8hF9rTJtwAdQsJHUdYu79Uzk4wxTdtW3bcoUKVkCUoELu
         6w5g==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=to:subject:message-id:date:from:references:in-reply-to:mime-version
         :sender:domainkey-signature:dkim-signature
         :arc-authentication-results;
        bh=FK3r7MQPV9BZEA25JO876WNSySmO6GfLseCX6KJ88Ek=;
        b=Dc/uIAid0xoujFwr0d4gGs5uFyQhf6HmTwQ0dIz343U849cCnE0EzODK+utNBG0vWy
         zbSKWMQ7ky/Mjhxv4MSAB8gIWPtDkNXUH1aDTfenbcYzRr6lubXSpLCwb5ybOROf0NyO
         bpq+rZriEJv8f44JOWIm/JnGv8l400P4WbWsZv6PqaevV3wcShQ150xtoqzbGCsyIdV0
         joQoB57MH2cuUOVM5/wgrZ31HzUCWjPas7EFpOAlte5YTVta9t7pKJ9IuM4x8Drxqz5T
         DjXGqgKFWuLOFgK9+9TX/8+tHCwhtbAjoVBCHGtvi7M/6FHMZxCFyWcRdLQOatA47fQh
         QvSA==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@miator.net;
       spf=pass (google.com: domain of bounce+3f9131.69110-std-proposals=isocpp.org@miator.net designates 184.173.153.196 as permitted sender) smtp.mailfrom=bounce+3f9131.69110-std-proposals=isocpp.org@miator.net
Original-Received: from mail-s68.mailgun.info (mail-s68.mailgun.info. [184.173.153.196])
        by mx.google.com with UTF8SMTPS id k9si13484616qtc.216.2017.05.20.14.01.32
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Sat, 20 May 2017 14:01:32 -0700 (PDT)
Received-SPF: pass (google.com: domain of bounce+3f9131.69110-std-proposals=isocpp.org@miator.net designates 184.173.153.196 as permitted sender) client-ip=184.173.153.196;
Original-Sender: zy@miator.net
X-Mailgun-Sending-Ip: 184.173.153.196
X-Mailgun-Sid: WyI3MTBkYiIsICJzdGQtcHJvcG9zYWxzQGlzb2NwcC5vcmciLCAiNjkxMTAiXQ==
Original-Received: from mail-pg0-f53.google.com (mail-pg0-f53.google.com [74.125.83.53])
 by mxa.mailgun.org with ESMTP id 5920aeac.7fc603ed3f30-smtp-out-n02;
 Sat, 20 May 2017 21:01:32 -0000 (UTC)
Original-Received: by mail-pg0-f53.google.com with SMTP id u187so52019226pgb.0
        for <std-proposals@isocpp.org>; Sat, 20 May 2017 14:01:32 -0700 (PDT)
X-Received: by 10.98.73.214 with SMTP id r83mr17408825pfi.12.1495314091946;
 Sat, 20 May 2017 14:01:31 -0700 (PDT)
Original-Received: by 10.100.151.71 with HTTP; Sat, 20 May 2017 14:01:31 -0700 (PDT)
In-Reply-To: <9dbebffff1732ae5966a93b69a836757@kdab.com>
X-Gmail-Original-Message-ID: <CAGsORuBi-W4ZjOiBbmPCErmkEVsa1zehi6fRfXr1EJ+=p6meyg@mail.gmail.com>
X-Original-Sender: zy@miator.net
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@miator.net;       spf=pass (google.com: domain of
 bounce+3f9131.69110-std-proposals=isocpp.org@miator.net designates
 184.173.153.196 as permitted sender) smtp.mailfrom=bounce+3f9131.69110-std-proposals=isocpp.org@miator.net
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:32537
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/32537>

--94eb2c0b916c473c5a054ffaf1bc
Content-Type: text/plain; charset="UTF-8"

On Sat, May 20, 2017 at 3:11 PM, Marc Mutz <marc.mutz@kdab.com> wrote:

>
>> auto x = (std::is_integral_v<T>) ? A{} : B{};
>>
>> This would be like if constexpr with implicit constexpr determinded by
>> the compiler.
>>
>
> I had the same idea the other day :)
>
> constexpr-if is explicit, why should the the ternary be different?
>
>   auto x = std::is_integral_v<T> constexpr ? A{} : B{};
>

Seems not so hard?

  auto x = std::conditional_t<std::is_integral_v<T>, A, B>{};

-- 
Zhihao Yuan, ID lichray
The best way to predict the future is to invent it.
_______________________________________________

-- 
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/CAGsORuBi-W4ZjOiBbmPCErmkEVsa1zehi6fRfXr1EJ%2B%3Dp6meyg%40mail.gmail.com.

--94eb2c0b916c473c5a054ffaf1bc
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_extra"><br><div class=3D"gmail_quote">=
On Sat, May 20, 2017 at 3:11 PM, Marc Mutz <span dir=3D"ltr">&lt;<a href=3D=
"mailto:marc.mutz@kdab.com" target=3D"_blank">marc.mutz@kdab.com</a>&gt;</s=
pan> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0p=
x 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><blockquot=
e class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px s=
olid rgb(204,204,204);padding-left:1ex"><br>
auto x =3D (std::is_integral_v&lt;T&gt;) ? A{} : B{};<br>
<br>
This would be like if constexpr with implicit constexpr determinded by<br>
the compiler.<br>
</blockquote>
<br>
I had the same idea the other day :)<br>
<br>
constexpr-if is explicit, why should the the ternary be different?<br>
<br>
=C2=A0 auto x =3D std::is_integral_v&lt;T&gt; constexpr ? A{} : B{};<br>
</blockquote></div><br></div><div class=3D"gmail_extra">Seems not so hard?<=
br></div><div class=3D"gmail_extra"><br></div><div class=3D"gmail_extra">=
=C2=A0 auto x =3D std::conditional_t&lt;std::is_integral_v&lt;T&gt;, A, B&g=
t;{};</div><div class=3D"gmail_extra"><br>-- <br><div class=3D"gmail_signat=
ure"><div dir=3D"ltr"><div><div dir=3D"ltr"><div><div dir=3D"ltr"><div>Zhih=
ao Yuan, ID lichray<br>The best way to predict the future is to invent it.<=
br>_______________________________________________<br></div></div></div></d=
iv></div></div></div>
</div></div>

<p></p>

-- <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 <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAGsORuBi-W4ZjOiBbmPCErmkEVsa1zehi6fR=
fXr1EJ%2B%3Dp6meyg%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter"=
>https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAGsORuBi-W4Z=
jOiBbmPCErmkEVsa1zehi6fRfXr1EJ%2B%3Dp6meyg%40mail.gmail.com</a>.<br />

--94eb2c0b916c473c5a054ffaf1bc--

.
