220 8716 <10a34567-ba5b-4549-88e3-51ce47867352@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: Olaf van der Spek <olafvdspek@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: string_view::is_null()
Date: Sun, 19 Jan 2014 16:11:32 -0800 (PST)
Lines: 79
Approved: news@gmane.org
Message-ID: <10a34567-ba5b-4549-88e3-51ce47867352@isocpp.org>
References: <CAPOJ94O19N207rjm73tKJSc7K55kOzYxHbY9wtXquk=_uqqMsA@mail.gmail.com>
 <8E74B747-7450-41E0-8D1E-48C2D6F81535@gmail.com>
 <CAGNvRgDH=X2h4K_u3zOu7gUNuQbAcNHGNh=HfCRO9qG1mmiG1w@mail.gmail.com>
 <CANh-dXnytwWwS7E_BGA-xK8E-zw788TJKzM=HJdC-9JbF7+gTQ@mail.gmail.com>
 <104254A6-C69A-4571-8455-89D7E466D493@gmail.com>
 <CANh-dXngzdnwZZnLRxd=AXQcqLaQky9Cpdw6pkbH8tFqRyZavw@mail.gmail.com>
 <6a95bf9c-55c9-4ae2-966f-d1b1f4df6a37@isocpp.org>
 <52D9E336.1060801@knejp.de>
 <1B534FD7-B385-4A7E-A718-3C73F0AB61DC@gmail.com>
 <11f13f8f-1270-427c-8942-94027a181ff4@isocpp.org>
 <20140119174431.GA16875@faust.lysator.liu.se>
 <CAPOJ94Nt8tinr8hGeR-=rWZS0a529kY38NU-yo6BYM6kVo7czg@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; 
	boundary="----=_Part_753_31806092.1390176692321"
X-Trace: ger.gmane.org 1390176687 11209 80.91.229.3 (20 Jan 2014 00:11:27 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Mon, 20 Jan 2014 00:11:27 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBC5NB45SSABBBNGT6GLAKGQE7WUKX3A@isocpp.org Mon Jan 20 01:11:35 2014
Return-path: <std-proposals+bncBC5NB45SSABBBNGT6GLAKGQE7WUKX3A@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yk0-f197.google.com ([209.85.160.197])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBC5NB45SSABBBNGT6GLAKGQE7WUKX3A@isocpp.org>)
	id 1W52Sk-00049R-Kv
	for gclcip-std-proposals@m.gmane.org; Mon, 20 Jan 2014 01:11:34 +0100
Original-Received: by mail-yk0-f197.google.com with SMTP id 20sf5233379yks.0
        for <gclcip-std-proposals@m.gmane.org>; Sun, 19 Jan 2014 16:11:33 -0800 (PST)
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
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe
         :content-type;
        bh=gLXAblZecx8Xina7rBxgvE9kjOwBfjAs9WYgsY6eeYE=;
        b=YxWId3BO4dEx8VcvYWRqnhOmkOO1QrKBo2PAXXCt3LDrW+WcYUpP7t4uaHQmSMeIKe
         kK3pffV0mZsuulsg001OoTC45R817IukiaR3ATPxAR+2YYe+SHE9Y0RnHOPltX+UeIHU
         PJUsS6YynD3QG3ZjOoS9TT+hFtDrNfnHDUjRQsOY+2GdvGZgfxzbLZ0ZKJrHkRd/e/sp
         05xUdWe9qEYPPN2FHp2gZu3b6xnARKMxz8v5kV8Oq3pG0vJQVr13gO0RdSktGCRzfldr
         Gw0wtdOIm62/Fskl8E+2fryMU5bs3FxO78R6xLa5PyXgaA5U9d4JZ8Hrz0LVTI7eWbYK
         j8PA==
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:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe:content-type;
        bh=gLXAblZecx8Xina7rBxgvE9kjOwBfjAs9WYgsY6eeYE=;
        b=TLW5gqk+FOLuy9jj0BpqYT28aN1NSoVNq+NqpEuAygV8mTSAB+CaFR52S7ajixiOb6
         ftlGDyPpOAmXTdcw1jwPVVQsyQ7MDX1cq9v0PYz78ebRafMyidtBk1iA8m/ghONqmZet
         3ZW+l9HRclUIiWFH6D9YOLFo11VUmFlkAYIs/5D0wVaJ3B9tI5nP7gv+mT99GvpJnA83
         WYdJVSzTrlq/yUleJxOcnWzTRFgZCLWMavEcpm8pIYdTEyDScHHoXJBl0w26PoEyaKSP
         lYMbCfaUQ980PRqhiAaBQQtWR1bCigLN8tLnY84iQ3csBTLF+GZAbt7uLtzoPo9t61Ry
         7xRg==
X-Gm-Message-State: ALoCoQku87jT9xIp2XTmg11VEUATHM2CbtovddDCAUN+2DWfPqoCNnlJhzIBLOheJwaaoTrCfE3a
X-Received: by 10.58.156.42 with SMTP id wb10mr5583680veb.26.1390176693269;
        Sun, 19 Jan 2014 16:11:33 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.140.32.228 with SMTP id h91ls908156qgh.14.gmail; Sun, 19 Jan
 2014 16:11:32 -0800 (PST)
X-Received: by 10.140.83.212 with SMTP id j78mr398148qgd.3.1390176692731;
        Sun, 19 Jan 2014 16:11:32 -0800 (PST)
In-Reply-To: <CAPOJ94Nt8tinr8hGeR-=rWZS0a529kY38NU-yo6BYM6kVo7czg@mail.gmail.com>
X-Original-Sender: olafvdspek@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:8716
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/8716>

------=_Part_753_31806092.1390176692321
Content-Type: text/plain; charset=UTF-8

Op zondag 19 januari 2014 19:31:19 UTC+1 schreef Peter Bigot:
>
> On further reflection it'd better to store a null pointer in m_ptr to 
> represent a default-constructed value but to return &m_nul from data() when 
> m_ptr is null.  
>

Having such conditionals in data() doesn't seem like a good idea. data() 
should be as simple (and as fast) as possible.

> constexpr basic_string_view(const charT* str, size_type len);
*> Requires*: str is not a null pointer and [str,str + len) is a valid 
range. 

What's the rationale for the not-null requirement? I don't like it, one 
should be able to construct a string_view from a NULL, 0 pair.
vector::data() could return NULL (AFAIK), so that'd mean I couldn't 
construct a string_view from v.data(), v.size()

-- 

--- 
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/.

------=_Part_753_31806092.1390176692321
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Op zondag 19 januari 2014 19:31:19 UTC+1 schreef Peter Big=
ot:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;=
border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div><div =
class=3D"gmail_quote"><div>On further reflection it'd better to store a nul=
l pointer in m_ptr to represent a default-constructed value but to return &=
amp;m_nul from data() when m_ptr is null. &nbsp;</div></div></div></div></b=
lockquote><div><br></div><div>Having such conditionals in data() doesn't se=
em like a good idea. data() should be as simple (and as fast) as possible.<=
/div><div><br></div><div>&gt;&nbsp;<span style=3D"white-space: inherit; col=
or: rgb(0, 0, 0);">constexpr basic_string_view(const charT* str, size_type =
len);</span></div><div><i style=3D"line-height: 18px; color: rgb(0, 0, 0); =
font-family: 'Times New Roman';">&gt; Requires</i><span style=3D"line-heigh=
t: 18px; color: rgb(0, 0, 0); font-family: 'Times New Roman';">:</span><spa=
n style=3D"line-height: 18px; color: rgb(0, 0, 0); font-family: 'Times New =
Roman';">&nbsp;</span><code style=3D"line-height: 18px; color: rgb(0, 0, 0)=
; white-space: nowrap;">str</code><span style=3D"line-height: 18px; color: =
rgb(0, 0, 0); font-family: 'Times New Roman';">&nbsp;</span><span style=3D"=
line-height: 18px; color: rgb(0, 0, 0); font-family: 'Times New Roman';">is=
 not a null pointer and [</span><code style=3D"line-height: 18px; color: rg=
b(0, 0, 0); white-space: nowrap;">str</code><span style=3D"line-height: 18p=
x; color: rgb(0, 0, 0); font-family: 'Times New Roman';">,</span><code styl=
e=3D"line-height: 18px; color: rgb(0, 0, 0); white-space: nowrap;">str + le=
n</code><span style=3D"line-height: 18px; color: rgb(0, 0, 0); font-family:=
 'Times New Roman';">) is a valid range.</span>&nbsp;</div><div><br></div><=
div>What's the rationale for the not-null requirement? I don't like it, one=
 should be able to construct a string_view from a NULL, 0 pair.</div><div>v=
ector::data() could return NULL (AFAIK), so that'd mean I couldn't construc=
t a string_view from v.data(), v.size()</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 />

------=_Part_753_31806092.1390176692321--

.
