220 29434 <10914b55-c188-4573-a4c7-ba686f213a38@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: TONGARI J <tongari95@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Allowing string literals to match `char...` packs
 in templates
Date: Wed, 16 Nov 2016 23:40:24 -0800 (PST)
Lines: 107
Approved: news@gmane.org
Message-ID: <10914b55-c188-4573-a4c7-ba686f213a38@isocpp.org>
References: <9de07b5f-f870-4a02-882f-54f9fdd12ffd@isocpp.org>
 <CANh8DEm_8ngPVZyMAP4GU8nbvgiD2XxBrLT0M1Pk94m8+tQrug@mail.gmail.com>
 <d9433fac-152f-4515-b518-985a78768c03@isocpp.org>
 <6b73bf50-4189-4d5d-a2c0-2debb085659e@isocpp.org>
 <f99786d0-d4fd-40ee-89fe-89399fe8d600@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_5649_555192666.1479368424159"
X-Trace: blaine.gmane.org 1479368426 17839 195.159.176.226 (17 Nov 2016 07:40:26 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Thu, 17 Nov 2016 07:40:26 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCC3NA775MLBB2F5WXAQKGQE5TE7WMQ@isocpp.org Thu Nov 17 08:40:22 2016
Return-path: <std-proposals+bncBCC3NA775MLBB2F5WXAQKGQE5TE7WMQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-pf0-f198.google.com ([209.85.192.198])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCC3NA775MLBB2F5WXAQKGQE5TE7WMQ@isocpp.org>)
	id 1c7HJ0-0003W2-AY
	for gclcip-std-proposals@m.gmane.org; Thu, 17 Nov 2016 08:40:22 +0100
Original-Received: by mail-pf0-f198.google.com with SMTP id 144sf105861971pfv.5
        for <gclcip-std-proposals@m.gmane.org>; Wed, 16 Nov 2016 23:40:25 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=zPQojh1XNTMABffU6Ma2CtPObiOa3u7P4kdUu1VKpYc=;
        b=lUIeKGRIT3rHNHXEgQSpPNZ8cWF152qGtWDemIpO/OeMRbty2/zcFZim0l3563AWIK
         +OU1sl443cFnzCkO4BXHACMr/lhhNjoVyoPB3/OMoRl0ddPQbu3xu8PT1mAWzmeLYEk2
         f3bxqv74jWiKzfXpOss8wtSAAqPzG8ANjx6obsb86vVUCMQqAywMT1Rj2VdB9yGwSSlh
         SApdCTz/XzqyFbhZguJSVzETIwny2a5tzklL2g65UdFkoa8flP+udy9grOpt3Qniaxcy
         kjpzE+u7X3Z7JmZ3j88TadPzFY1rT0i1k5wfFAtNxpCjbvw8OviP2lXCq2T8QDCJqnoS
         kSaA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=zPQojh1XNTMABffU6Ma2CtPObiOa3u7P4kdUu1VKpYc=;
        b=QcIfVvLdfJMjeR10+hJ5Dby5LuyMrk7++wyEHY1F20Yr0XN3bl23GA9xEjVfWLVgBa
         ks4/lxcKkAugjsmoH1KndjqZwzwEKizT+2nydIvNxU1IFGS3H/1JSw7sPdcCjzN7Kxop
         xRquiZ3qa0SaeriIkaauyH71i9AJmYLVoZn6iE+Ug7jwwR5gUpbSaXV/7btCg/G/8Iao
         VZtRQHDDP/tsn9uYZvyLVMIdcqCCx0j5O6JUwGjIukHjpZ4U4tiaa/mTIVmaczcqwbWF
         K6vAu915g+spvBLHZxqKn3yil1Prl90dfBkZWshYy+cOVp7HjVhuzNpf9Q9bB8oWDHYH
         gU7A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:date:from:to:message-id:in-reply-to:references
         :subject:mime-version:x-original-sender:reply-to:precedence
         :mailing-list:list-id:x-spam-checked-in-group:list-post:list-help
         :list-archive:list-subscribe:list-unsubscribe;
        bh=zPQojh1XNTMABffU6Ma2CtPObiOa3u7P4kdUu1VKpYc=;
        b=c8zWHRvx9fmfcef0yfaCtCKoTq0iwkXzcVyc6zrf5Js7XKIwQMLIaUg0gQXGyxStxQ
         Xw3XgYFQnX2knUM/mwU64+gLPDakZm9XmQAxgdk57CZfYbanqMvje1TGl4CLcfpVyQIA
         65w6P5P46dGMEFfboT37j1ABrdHH2QJlOV2/i20q45ZunhJ7gc87QuevNuCenqnig6tk
         kXGnz/SxziVLeZF+6ifrmpxrjkDzOvmBgFRqLjbgiJIxaKipDZ8sIGTVXbrVwfShNIn/
         fNWdrvOMCQHvajM050Wby8aevvF8PDOgsc5gkFKXRdOSeoHV4IyGlluSSWs8ktcVnEKM
         ejpw==
X-Gm-Message-State: ABUngvcQJoS3xKY3OP2hgCyQkBxi9NASa8q6acBcZW1EioyOtaEZ74HW5N+Q9MDWlucQvQ==
X-Received: by 10.99.127.83 with SMTP id p19mr637785pgn.107.1479368425350;
        Wed, 16 Nov 2016 23:40:25 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.157.36.65 with SMTP id p59ls3491421ota.40.gmail; Wed, 16 Nov
 2016 23:40:24 -0800 (PST)
X-Received: by 10.157.20.197 with SMTP id r5mr101992otr.9.1479368424591;
        Wed, 16 Nov 2016 23:40:24 -0800 (PST)
In-Reply-To: <f99786d0-d4fd-40ee-89fe-89399fe8d600@isocpp.org>
X-Original-Sender: tongari95@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:29434
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/29434>

------=_Part_5649_555192666.1479368424159
Content-Type: multipart/alternative; 
	boundary="----=_Part_5650_413995084.1479368424160"

------=_Part_5650_413995084.1479368424160
Content-Type: text/plain; charset=UTF-8

On Thursday, November 17, 2016 at 3:23:00 PM UTC+8, Louis Dionne wrote:
>
> No, this has not been discussed AFAICT. That's not a bad idea, but it does 
> seem very magic to me.
> I don't know whether it's more desirable to introduce this special case or 
> to "fix" the problem by
> allowing user defined types with some restrictions as template arguments. 
> Certainly the latter is
> cleaner, but also much more difficult.
>

It's only as magic as lambda expressions :)
The idea is very similar, the big difference is that lambda will give you 
different types even if the expressions are lexically the same, while this 
will give you the same type as long as the string-literals are the same.
Further more, we can define some useful operations to help string 
processing, e.g.

static_assert(is_same<decltype("Hello"lit + " World"lit), decltype("Hello 
World"lit)>::value);

This is certainly not as general as allowing UDTs as template arguments, 
but should solve a practical problem in compile-time string processing.

-- 
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/10914b55-c188-4573-a4c7-ba686f213a38%40isocpp.org.

------=_Part_5650_413995084.1479368424160
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Thursday, November 17, 2016 at 3:23:00 PM UTC+8, Louis =
Dionne wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-le=
ft: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">=
No, this has not been discussed AFAICT. That&#39;s not a bad idea, but it d=
oes seem very magic to me.<div>I don&#39;t know whether it&#39;s more desir=
able to introduce this special case or to &quot;fix&quot; the problem by</d=
iv><div>allowing user defined types with some restrictions as template argu=
ments. Certainly the latter is</div><div>cleaner, but also much more diffic=
ult.</div></div></blockquote><div><br></div><div style=3D"font-family: aria=
l, sans-serif; font-size: small;">It&#39;s only as magic as lambda expressi=
ons :)</div><div style=3D"font-family: arial, sans-serif; font-size: small;=
">The idea is very similar, the big difference is that lambda will give you=
 different types even if the expressions are lexically the same, while this=
 will give you the same type as long as the string-literals are the same.</=
div><div style=3D"font-family: arial, sans-serif; font-size: small;">Furthe=
r more, we can define some useful operations to help string processing, e.g=
..</div><div style=3D"font-family: arial, sans-serif; font-size: small;"><br=
></div><div class=3D"prettyprint" style=3D"background-color: rgb(250, 250, =
250); border-color: rgb(187, 187, 187); border-style: solid; border-width: =
1px; word-wrap: break-word;"><code class=3D"prettyprint"><div class=3D"subp=
rettyprint"><span style=3D"color: #008;" class=3D"styled-by-prettify">stati=
c_assert</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify">is_same</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><sp=
an style=3D"color: #008;" class=3D"styled-by-prettify">decltype</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D=
"color: #080;" class=3D"styled-by-prettify">&quot;Hello&quot;</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify">lit </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">+</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #080;" =
class=3D"styled-by-prettify">&quot; World&quot;</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify">lit</span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">),</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">decltype</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">(</span><span style=3D"color: #080;" class=3D"styled-by-pretti=
fy">&quot;Hello World&quot;</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify">lit</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">)&gt;::</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify">value</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">);</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></=
span></div></code></div><div><br><span style=3D"font-family: arial, sans-se=
rif; font-size: small;">This is certainly not as general as allowing UDTs a=
s template arguments, but should solve a practical problem in compile-time =
string processing.</span></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/10914b55-c188-4573-a4c7-ba686f213a38%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/10914b55-c188-4573-a4c7-ba686f213a38=
%40isocpp.org</a>.<br />

------=_Part_5650_413995084.1479368424160--

------=_Part_5649_555192666.1479368424159--

.
