220 33840 <51add97a-3379-4b9e-9bd3-8972ed0e7636@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Nicol Bolas <jmckesson@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: string_view for fstream::open()
Date: Fri, 11 Aug 2017 12:09:18 -0700 (PDT)
Lines: 99
Approved: news@gmane.org
Message-ID: <51add97a-3379-4b9e-9bd3-8972ed0e7636@isocpp.org>
References: <cb7b55ab-7113-4d99-949b-8568627d0b7f@isocpp.org> <3456831.gsseCm4DuK@tjmaciei-mobl1> <6240d6af-a518-4788-a56f-b7d0c8976dc4@isocpp.org>
 <250415405.SNDfSfLC7e@tjmaciei-mobl1>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_2226_1153724885.1502478558852"
X-Trace: blaine.gmane.org 1502478562 2608 195.159.176.226 (11 Aug 2017 19:09:22 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Fri, 11 Aug 2017 19:09:22 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCEKFTV6ZUMBBX4BXDGAKGQECKXQ6TA@isocpp.org Fri Aug 11 21:09:18 2017
Return-path: <std-proposals+bncBCEKFTV6ZUMBBX4BXDGAKGQECKXQ6TA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-vk0-f71.google.com ([209.85.213.71])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCEKFTV6ZUMBBX4BXDGAKGQECKXQ6TA@isocpp.org>)
	id 1dgFJ4-0000GO-Re
	for gclcip-std-proposals@m.gmane.org; Fri, 11 Aug 2017 21:09:14 +0200
Original-Received: by mail-vk0-f71.google.com with SMTP id u200sf17213100vkd.1
        for <gclcip-std-proposals@m.gmane.org>; Fri, 11 Aug 2017 12:09:21 -0700 (PDT)
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
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=kwKSbhTwe1sURT7PthXxteRn0w1xOxJogQ6ibhTwmw4=;
        b=XPUJidhZOiMMFYEPKT/ISPzhStdoYqV9exRrUQZaqbDU1DEJDjRd3gbX2C1xslrVVF
         UHcI9O4zPU8+UGZiEbcJPWvisb5VtKtgpRGOU2+t0ufB4TW3ekTIaVB43ezJjTPkrhC1
         8lzfBFd6U7BtPq9eSzXuWMepzc9oawBjDRFA8byoyKVv8zuvxEBjiV3ntbvqG3Wob6ro
         5DE814ZKXVSlj2KVgqPc4jyzhv7gH8Ky7FfMLbGcS9bJrKhIKOEaqnY5RnAkh8kh0lQP
         GobAKRpl3TNVbDchFbpwZe3emWMmpr+dtMw5xTucB/PixHZK55wXJ6C4Byn1dn4eF2wo
         LWdg==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=kwKSbhTwe1sURT7PthXxteRn0w1xOxJogQ6ibhTwmw4=;
        b=OHXD6d+5LrhpQe4LCypsnM3jcJo/OGE556ORG7F9A4Hmr/zGprOsvIxIsWczf4uCiK
         ZpSnZ6Gx9XiigBbXX2KN6L6cfY30A9goMpK3bCoF5Lh586V6riL4h6eOzdm/oNsyfVHN
         fUQjznivGxl4usv40fFOQqpUYMEvQSi8Yf4TsSWd/5GZxpFd5G/nxbPcighWpkLloe8w
         VelRSD8+9tQI32J4/lim7jsMBKqagRL89tVmS3+C3nCdSpPYtjQdGUIwDxSNKJ0f7E7z
         r9zDE309y9CNXisDPlJLvmqC5kzxefpD33DCDN//HbwtJK7UAvibMiejSTmCub5BDSla
         rAgQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        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=kwKSbhTwe1sURT7PthXxteRn0w1xOxJogQ6ibhTwmw4=;
        b=KM+CoGnJKfLAfViNfFCy9Ghs9QT3xYzj1TRQxLXkasyH8ejaOvpLCWfld7OnBXDOlE
         SHLtBENrT6uouRw+X9wZvCAmybm22yXNt4VVtpAxQ9hDllpdjoWFSGhwRgVRkQfHSBO9
         KMdROW4/R5U0W9DMbzUMyqi09QfvE052g6Q8+QDdARNe21A0RSs9Jx6w0l70u4F6AzHb
         f1/6vSqt9Ve0yY/6CnuvdcerD8KrWLxNKJrZs/UEJDDrF/bNRJTdgiX+IZH2RLLV/0wc
         Obw7DrwGjl2jTL4gg+m0xhM4KfIaSGq5twgD5VKXmm9pZm1KZB5oMtEmwneNpoW1QYcl
         gbsw==
X-Gm-Message-State: AHYfb5ibKZahh5qbl8g3IxOLzGfD/qsn4qdWH0icSbAS4xIukFEsTQOS
	1rXjfm8hRBjkNSku
X-Received: by 10.176.19.111 with SMTP id h44mr9957027uae.5.1502478560713;
        Fri, 11 Aug 2017 12:09:20 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.36.31.16 with SMTP id d16ls145143itd.4.gmail; Fri, 11 Aug 2017
 12:09:19 -0700 (PDT)
X-Received: by 10.31.153.84 with SMTP id b81mr94740vke.14.1502478559422;
        Fri, 11 Aug 2017 12:09:19 -0700 (PDT)
In-Reply-To: <250415405.SNDfSfLC7e@tjmaciei-mobl1>
X-Original-Sender: jmckesson@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:33840
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/33840>

------=_Part_2226_1153724885.1502478558852
Content-Type: multipart/alternative; 
	boundary="----=_Part_2227_1641056724.1502478558852"

------=_Part_2227_1641056724.1502478558852
Content-Type: text/plain; charset="UTF-8"

On Friday, August 11, 2017 at 2:12:42 PM UTC-4, Thiago Macieira wrote:
>
> On sexta-feira, 11 de agosto de 2017 10:01:28 PDT Nicol Bolas wrote: 
> > `zstring_view` is conceptually a `string_view`. This means that it is a 
> > pointer+size, so `size()` is always O(1). But this also means that if 
> you 
> > try to put a literal in a `zstring_view`, it will have to invoke 
> > `char_traits::length` to get the length. This is good if you're actually 
> > going to use begin/end iterator pairs. But it's painful if you're just 
> > doing one-time forward iteration. 
> > 
> > `cstring_view` is just a `const char*` with a nice wrapper. It is just a 
> > pointer, which means `size()` is always O(n). But this also means that 
> > sticking a literal in it costs nothing. But if you try to use it with 
> > begin/end iterator pairs, you provoke an O(n) operation. 
>
> int main(std::initializer_list<std::cstring_view>) 
>
> can be accomplished with a simple instruction inserted by the compiler at 
> the 
> beginning of main(),


How, exactly? `cstring_view` would not be *required* to be implemented as 
identical to `const char*`, after all. So there's no way to could guarantee 
that the `argv` array would be equivalent to that.

Also, it's not exactly a motivational use case for the type.

-- 
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/51add97a-3379-4b9e-9bd3-8972ed0e7636%40isocpp.org.

------=_Part_2227_1641056724.1502478558852
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Friday, August 11, 2017 at 2:12:42 PM UTC-4, Thiago Mac=
ieira wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-lef=
t: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">On sexta-feira, 11=
 de agosto de 2017 10:01:28 PDT Nicol Bolas wrote:
<br>&gt; `zstring_view` is conceptually a `string_view`. This means that it=
 is a
<br>&gt; pointer+size, so `size()` is always O(1). But this also means that=
 if you
<br>&gt; try to put a literal in a `zstring_view`, it will have to invoke
<br>&gt; `char_traits::length` to get the length. This is good if you&#39;r=
e actually
<br>&gt; going to use begin/end iterator pairs. But it&#39;s painful if you=
&#39;re just
<br>&gt; doing one-time forward iteration.
<br>&gt;=20
<br>&gt; `cstring_view` is just a `const char*` with a nice wrapper. It is =
just a
<br>&gt; pointer, which means `size()` is always O(n). But this also means =
that
<br>&gt; sticking a literal in it costs nothing. But if you try to use it w=
ith
<br>&gt; begin/end iterator pairs, you provoke an O(n) operation.
<br>
<br>int main(std::initializer_list&lt;<wbr>std::cstring_view&gt;)
<br>
<br>can be accomplished with a simple instruction inserted by the compiler =
at the=20
<br>beginning of main(),</blockquote><div><br>How, exactly? `cstring_view` =
would not be <i>required</i> to be implemented as identical to `const char*=
`, after all. So there&#39;s no way to could guarantee that the `argv` arra=
y would be equivalent to that.<br><br>Also, it&#39;s not exactly a motivati=
onal use case for the type.</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/51add97a-3379-4b9e-9bd3-8972ed0e7636%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/51add97a-3379-4b9e-9bd3-8972ed0e7636=
%40isocpp.org</a>.<br />

------=_Part_2227_1641056724.1502478558852--

------=_Part_2226_1153724885.1502478558852--

.
