220 8681 <dc982a9d-541c-4472-96f8-bed3327edeb0@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: abolz.lists@gmail.com
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: string_view::is_null()
Date: Sat, 18 Jan 2014 07:30:17 -0800 (PST)
Lines: 80
Approved: news@gmane.org
Message-ID: <dc982a9d-541c-4472-96f8-bed3327edeb0@isocpp.org>
References: <8045a4d2-721d-4725-8bb7-7a91b6f53ec8@isocpp.org> <186E0927-C962-4E34-AED0-E7509DD1F0A0@gmail.com> <7aad44d8-6b4e-438a-b309-bd898b994b34@isocpp.org> <9C2C439F-7983-4224-B272-53CAD0E2E456@gmail.com> <CANh-dXnYg=1kmm1nJdSnTXmYyfBxbLTD9b+wecT+eZm5nPkf2A@mail.gmail.com> <CAGg_6+Pz0gQQcY_Vq6LTMFc-4iOJvVN1O3jc3gjh0J2egBTgGg@mail.gmail.com> <CANh-dX=Dr35_jvxadm2HWxNk6e87y8V+Dkyiw+syBfgfdTfobw@mail.gmail.com> <CAPOJ94O19N207rjm73tKJSc7K55kOzYxHbY9wtXquk=_uqqMsA@mail.gmail.com>
 <8E74B747-7450-41E0-8D1E-48C2D6F81535@gmail.com>
 <d17db29f-8da3-402f-834a-66b02e4d9621@isocpp.org>
 <3a3d55c0-20cb-40ff-ae46-84663d21f44d@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; 
	boundary="----=_Part_327_24944384.1390059017415"
X-Trace: ger.gmane.org 1390059015 29967 80.91.229.3 (18 Jan 2014 15:30:15 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sat, 18 Jan 2014 15:30:15 +0000 (UTC)
Cc: gornishanov@gmail.com
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCAJPLFFWYPBBCN45KLAKGQEYESA3UI@isocpp.org Sat Jan 18 16:30:20 2014
Return-path: <std-proposals+bncBCAJPLFFWYPBBCN45KLAKGQEYESA3UI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ob0-f198.google.com ([209.85.214.198])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCAJPLFFWYPBBCN45KLAKGQEYESA3UI@isocpp.org>)
	id 1W4Xql-0006Qc-Ms
	for gclcip-std-proposals@m.gmane.org; Sat, 18 Jan 2014 16:30:20 +0100
Original-Received: by mail-ob0-f198.google.com with SMTP id wp4sf2051006obc.9
        for <gclcip-std-proposals@m.gmane.org>; Sat, 18 Jan 2014 07:30:18 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=date:from:to:cc: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=RTrqbg01nKXAuhteHQZuMeN1Ppu4eFejr+wfMaSj5SY=;
        b=s/Fx/9JmtKs5iCYMGSnC1f37JAeJCd53OmzfVe2kgLciKrXAwbKFljrEZw1WNWj6b+
         Gk7RXOkthxSYNW8QC8R5fHwB9aFpqJu3ph9FTxzEteTdtAHmGK1hKFpdYfJ6m2f+LYLg
         kMVKFW58v8c1C2WN+WHh1S/Pgi7zvxF8ozu3Vv/pj7dbQHbn36467KzzxJRah6p5yphb
         hqX/M3s31CBEo/gr3B8MORFT57ZMu3KPEJxkMs00HL1pcr6I1oUopqBYaBOGukJpR8g8
         K5DNWiVRxaznIxHo6Ezja4DkCCq2wY98D1Y3Cff7MyYgNqhEFEW6XCMeyQ1XbPqn4ZHi
         fDDw==
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:cc: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=RTrqbg01nKXAuhteHQZuMeN1Ppu4eFejr+wfMaSj5SY=;
        b=KhogRflLEgVchIX9NWsuyE+fCsR8TCMXK2pCRXvWREuu+eAjFt7uvT4xfUxcAzOlH9
         jNNnuJq0XGkCRB49+EGwET2YCAe3h9Vngjo/4RB7BSvLplF5+eBhDcpYh7OO+UpJoK5K
         GZ3h+nhdFpMFjg7JU0A4XEZnp/t1tNFw/7K/yYC0s8fYV2EO04gYLDIii6vrPIwmoygO
         FyhuoVfOp+PQielZAvbBYLM2Oa4esrI+vjtaBNYJy8gbaH1+VD/0pKS+bUsk564i18qf
         VCac90CGLzX6M3FAwD3LJyAmIdwrs7ozh8wIT6I4GrdIi5LlZqZgVMCBErDdtu8Kx40B
         HgPw==
X-Gm-Message-State: ALoCoQkWNl+J3hARrEpKIOpOoTqNDlrws+AbzrW0st0slXSc7ZGXf92yyXQI5ncBUeWeNNsIr/nK
X-Received: by 10.182.126.137 with SMTP id my9mr3099368obb.13.1390059018428;
        Sat, 18 Jan 2014 07:30:18 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.49.17.196 with SMTP id q4ls1452245qed.11.gmail; Sat, 18 Jan
 2014 07:30:17 -0800 (PST)
X-Received: by 10.140.102.35 with SMTP id v32mr11433qge.26.1390059017811;
        Sat, 18 Jan 2014 07:30:17 -0800 (PST)
In-Reply-To: <3a3d55c0-20cb-40ff-ae46-84663d21f44d@isocpp.org>
X-Original-Sender: abolzlists@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:8681
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/8681>

------=_Part_327_24944384.1390059017415
Content-Type: text/plain; charset=UTF-8

Am Samstag, 18. Januar 2014 00:10:41 UTC+1 schrieb gorni...@gmail.com:
>
> What if string_view provides a specialization for optional<string_view<>>?
>
> That way optional<string_view> can be implemented very efficiently by 
> checking if sv.begin() == nullptr and does not consume any extra storage. 
> An extra benefit is that we have clear distinction between nullable types 
> (optional<T>) and regular types, int, vector, string_view, etc.
>
> Will this solution satisfy the original poster?
>

An (unspecialized) optional<string_view> is not always an option. E.g. I 
can't simply change a function like

void f(char const* s) {}

to

void f(optional<string_view> s) {}

because I can no longer write f("hello"). So the specialization should be 
implicitly constructible from a char array.
And then an optional<string_view> constructed from a nullptr should be an 
uninitialized optional since there
are no preconditions on f, I should be able to write 
f(getenv("not-an-env-var")).

-- 

--- 
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_327_24944384.1390059017415
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Am Samstag, 18. Januar 2014 00:10:41 UTC+1 schrieb gorni..=
..@gmail.com:<blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px 0px =
0.8ex; padding-left: 1ex; border-left-color: rgb(204, 204, 204); border-lef=
t-width: 1px; border-left-style: solid;"><div dir=3D"ltr"><div>What if stri=
ng_view provides a specialization for optional&lt;string_view&lt;&gt;&gt;?<=
/div><div><br></div><div>That way optional&lt;string_view&gt; can be implem=
ented very efficiently by checking if sv.begin() =3D=3D nullptr and does no=
t consume any extra storage. An extra benefit is that we have clear distinc=
tion between nullable types (optional&lt;T&gt;) and regular types, int, vec=
tor, string_view, etc.</div><div><br></div><div>Will this solution satisfy =
the original poster?<br></div></div></blockquote><div><br></div><div>An (un=
specialized) optional&lt;string_view&gt; is not always an option. E.g. I ca=
n't simply&nbsp;change a function like</div><div><br></div><div>void f(char=
 const* s) {}</div><div><br></div><div>to</div><div><br></div><div>void f(o=
ptional&lt;string_view&gt; s) {}</div><div><br></div><div>because I can no =
longer write f("hello"). So the specialization should be implicitly constru=
ctible from&nbsp;a char array.</div><div>And then an optional&lt;string_vie=
w&gt; constructed from a nullptr should be an uninitialized optional since =
there</div><div>are no preconditions on f, I should be able to write f(gete=
nv("not-an-env-var")).</div><div><br></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_327_24944384.1390059017415--

.
