220 2961 <02b7e63e-cd7d-4432-b3c1-fea6ecaf823e@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: Johannes Schaub <schaub.johannes@googlemail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Improvements for string literals
Date: Wed, 20 Feb 2013 15:34:33 -0800 (PST)
Lines: 86
Approved: news@gmane.org
Message-ID: <02b7e63e-cd7d-4432-b3c1-fea6ecaf823e@isocpp.org>
References: <913f9603-aff2-4abf-a330-d4d0f8a2d1e0@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; 
	boundary="----=_Part_1094_25195516.1361403273116"
X-Trace: ger.gmane.org 1361403276 22715 80.91.229.3 (20 Feb 2013 23:34:36 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Wed, 20 Feb 2013 23:34:36 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCQPNCEZSQNBBCV3SWEQKGQEP5GPDBQ@isocpp.org Thu Feb 21 00:34:59 2013
Return-path: <std-proposals+bncBCQPNCEZSQNBBCV3SWEQKGQEP5GPDBQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-vb0-f70.google.com ([209.85.212.70])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCQPNCEZSQNBBCV3SWEQKGQEP5GPDBQ@isocpp.org>)
	id 1U8JBf-0003mT-3K
	for gclcip-std-proposals@m.gmane.org; Thu, 21 Feb 2013 00:34:55 +0100
Original-Received: by mail-vb0-f70.google.com with SMTP id s24sf11117154vbi.1
        for <gclcip-std-proposals@m.gmane.org>; Wed, 20 Feb 2013 15:34:34 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=googlemail.com; s=20120113;
        h=x-received:x-beenthere:x-received:date:from:to:message-id
         :in-reply-to:references: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=yoJXVsuQ0TcsTJRdVDR5qti0QrKmt6/geZmmGxU0L/o=;
        b=xIKwJZqjFjE9I5uyKyWrZYIEIHUgvPcdj7I3KQwMsAgVQG/hkWGCrXaEk4mgr1dWiB
         bXzdB/aRzxR1l/ASeFIE6B0Yz5GQE//tuvS1ML2phdH8rV3cBob5QGkzQegFzaPh2se8
         cblwGr9p0P/pVQNQvgKU1ICyZf+DTsWBwxaH/GmbT0VOzk6cow1Ud+ysTHB/dlw8LrzW
         slHO/t1+1PWuZMeLHL+KV6GV7FjCKylI1zwLLK12CI3Ys10Tmres+HwrEJTytrs6Vxkz
         HiZpiwVisiY84VkIEXMmOOeI3wGGOwJ7x64/6VoNSJ5QWN2t/NQH1+5YgiZ7zkBrUI3z
         dzQg==
X-Received: by 10.236.133.242 with SMTP id q78mr11188534yhi.22.1361403274266;
        Wed, 20 Feb 2013 15:34:34 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.49.63.137 with SMTP id g9ls3075904qes.87.gmail; Wed, 20 Feb
 2013 15:34:33 -0800 (PST)
X-Received: by 10.49.4.231 with SMTP id n7mr1852207qen.34.1361403273427;
        Wed, 20 Feb 2013 15:34:33 -0800 (PST)
In-Reply-To: <913f9603-aff2-4abf-a330-d4d0f8a2d1e0@isocpp.org>
X-Original-Sender: schaub.johannes@googlemail.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:2961
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/2961>

------=_Part_1094_25195516.1361403273116
Content-Type: text/plain; charset=ISO-8859-1



On Monday, February 11, 2013 3:52:27 AM UTC+1, Nicol Bolas wrote:
>
> Note: the type `charT` refers to any of the available character types, for 
> the various string literals.
>
> It is often useful to want to differentiate between a mere string and a 
> string that comes from a string literal. So what I was thinking was that 
> string literals should return some specialized type, which can be used 
> instead of a `const charT[]`/`const charT*`.
>
>
I have proposed in some discussions that we could also have a type that is 
special cased by overload resolution similar to std::initializer_list. 
Where that type is special cased for "{...}", our additional type is 
special cased for string literals. Example:

    void f(string_ref s) {

    }

    void f(const char (&x)[4]) { }

string_ref could be that language-support type. When you then call f with a 
string literal "foo", special overload resolution rules say that the first 
f is picked, even though the conversion sequence for both parameters would 
be an identity conversion (string-literal -> string_ref => identity 
conversion. not a user defined conversion sequence!).

-- 

--- 
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_1094_25195516.1361403273116
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<br><br>On Monday, February 11, 2013 3:52:27 AM UTC+1, Nicol Bolas wrote:<b=
lockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;borde=
r-left: 1px #ccc solid;padding-left: 1ex;">Note: the type `charT` refers to=
 any of the available character types, for the various string literals.<br>=
<br>It is often useful to want to differentiate between a mere string and a=
 string that comes from a string literal. So what I was thinking was that s=
tring literals should return some specialized type, which can be used inste=
ad of a `const charT[]`/`const charT*`.<br><br></blockquote><div><br></div>=
<div>I have proposed in some discussions that we could also have a type tha=
t is special cased by overload resolution similar to std::initializer_list.=
 Where that type is special cased for "{...}", our additional type is speci=
al cased for string literals. Example:</div><div><br></div><div>&nbsp; &nbs=
p; void f(string_ref s) {</div><div><br></div><div>&nbsp; &nbsp; }</div><di=
v><br></div><div>&nbsp; &nbsp; void f(const char (&amp;x)[4]) { }</div><div=
><br></div><div>string_ref could be that language-support type. When you th=
en call f with a string literal "foo", special overload resolution rules sa=
y that the first f is picked, even though the conversion sequence for both =
parameters would be an identity conversion (string-literal -&gt; string_ref=
 =3D&gt; identity conversion. not a user defined conversion sequence!).</di=
v>

<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_1094_25195516.1361403273116--

.
