220 14518 <CADbh+eTj7vNvdPR6rfhKR44h6cZxqe_kEVZUd5m_VQr3gNNTvQ@mail.gmail.com> article
Path: news.gmane.org!not-for-mail
From: Brent Friedman <fourthgeek@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: Range-based if
Date: Wed, 12 Nov 2014 20:52:06 -0600
Lines: 127
Approved: news@gmane.org
Message-ID: <CADbh+eTj7vNvdPR6rfhKR44h6cZxqe_kEVZUd5m_VQr3gNNTvQ@mail.gmail.com>
References: <CADbh+eQCaTPArs7YBUg9mYwrnJ2Gu3SRAfqUbPiLscpyxV8JqQ@mail.gmail.com>
	<m3tvcu$9ia$1@ger.gmane.org>
	<CADbh+eScmZMj4dcQv73re1dM0VNbw_PeHRc_FPWNONoKNKsiMg@mail.gmail.com>
	<c1a0a498-adca-44c7-a9fc-67a979967e6a@isocpp.org>
	<CADbh+eS+nGHpqRBUCbUFGX3+fXWiiCD0C=nvjpAUZDm_=+N2-g@mail.gmail.com>
	<e31c06ae-6bbb-4822-9555-38f289400ce0@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary=001a1137d89e04f47e0507b4998a
X-Trace: ger.gmane.org 1415847135 29065 80.91.229.3 (13 Nov 2014 02:52:15 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Thu, 13 Nov 2014 02:52:15 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCHLPXGUXMJBBVVZSCRQKGQEHY63PRQ@isocpp.org Thu Nov 13 03:52:09 2014
Return-path: <std-proposals+bncBCHLPXGUXMJBBVVZSCRQKGQEHY63PRQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ie0-f199.google.com ([209.85.223.199])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCHLPXGUXMJBBVVZSCRQKGQEHY63PRQ@isocpp.org>)
	id 1XokW0-0001Gw-F2
	for gclcip-std-proposals@m.gmane.org; Thu, 13 Nov 2014 03:52:08 +0100
Original-Received: by mail-ie0-f199.google.com with SMTP id x19sf72526945ier.10
        for <gclcip-std-proposals@m.gmane.org>; Wed, 12 Nov 2014 18:52:07 -0800 (PST)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:mime-version:in-reply-to:references:date
         :message-id:subject:from:to:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe:content-type;
        bh=+uaGToJcF68vD6I10aIOKMpuG0kctBVITeMoJ89yYmE=;
        b=QUI9zSOB9bIfsTXkJyVj9MitFDb2Etxx32ZMCThEzIek5Uadl6JLgrAysnkDVbE4bn
         wP1t34x9yoVoXuSvdcoaHaIwxsZ5gIjVxSM3XYxwkl4bo9g87ZZB0cS3EGkjVLE4JjxO
         pL8ZDXZ248d+jqzSp+41FOR9lI3Y7BwrCXFXaxiQtVM4kXO4+9mal/wHokBxS1SdyEhd
         pcH6L//ghvqlPpAqJCYqjpZbgbDUf/hag878urR7Vt8n+h0r7BwLlfg2bHf0A2FP4A/a
         +lGEbTvm38Thm9qUifQbriee7gREtgqUWQG9alSd6B9RhTF5vAe8aSGLA34nqygrD3ke
         9BLA==
X-Gm-Message-State: ALoCoQmoYfdJaX7ywq6NtLyIHuS2fMWJOieR+470vyIj7BBUrEnfT6q4ZbxDNQz2ViwKMxd1avT1
X-Received: by 10.42.203.136 with SMTP id fi8mr47517313icb.18.1415847127544;
        Wed, 12 Nov 2014 18:52:07 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.182.225.130 with SMTP id rk2ls1134228obc.32.gmail; Wed, 12 Nov
 2014 18:52:06 -0800 (PST)
X-Received: by 10.202.4.5 with SMTP id 5mr5457397oie.22.1415847126419;
        Wed, 12 Nov 2014 18:52:06 -0800 (PST)
Original-Received: from mail-oi0-x230.google.com (mail-oi0-x230.google.com. [2607:f8b0:4003:c06::230])
        by mx.google.com with ESMTPS id g74si16605446oic.44.2014.11.12.18.52.06
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Wed, 12 Nov 2014 18:52:06 -0800 (PST)
Received-SPF: pass (google.com: domain of fourthgeek@gmail.com designates 2607:f8b0:4003:c06::230 as permitted sender) client-ip=2607:f8b0:4003:c06::230;
Original-Received: by mail-oi0-f48.google.com with SMTP id x69so9653887oia.35
        for <std-proposals@isocpp.org>; Wed, 12 Nov 2014 18:52:06 -0800 (PST)
X-Received: by 10.202.203.66 with SMTP id b63mr13140oig.60.1415847126297; Wed,
 12 Nov 2014 18:52:06 -0800 (PST)
Original-Received: by 10.202.232.77 with HTTP; Wed, 12 Nov 2014 18:52:06 -0800 (PST)
In-Reply-To: <e31c06ae-6bbb-4822-9555-38f289400ce0@isocpp.org>
X-Original-Sender: fourthgeek@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of fourthgeek@gmail.com designates 2607:f8b0:4003:c06::230 as
 permitted sender) smtp.mail=fourthgeek@gmail.com;       dkim=pass
 header.i=@gmail.com;       dmarc=pass (p=NONE dis=NONE) header.from=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: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:14518
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/14518>

--001a1137d89e04f47e0507b4998a
Content-Type: text/plain; charset=UTF-8

> The idea is, it is a pointer (how can it not be?).

It absolutely doesn't have to be a pointer. We use range adaptors in our
code for filtering, mapping, dynamic_casting, and the like. These iterators
are not pointers, and cannot be constructed from nullptr_t. We also have
counting iterators that store and increment a number, so there's not even a
notion of some underlying memory location at all.

A function like first_or_null which returns an optional<T&> could probably
work alright for our purposes with only a bit of extra syntax over this
range-if idea.

On Wed, Nov 12, 2014 at 8:47 PM, Benjamin Lindley <benjameslindley@gmail.com
> wrote:

>
>
> On Wednesday, November 12, 2014 8:31:37 PM UTC-6, Brent Friedman wrote:
>>
>> > It doesn't assume that the iterators are pointers, if that's what you
>> mean.
>> It assumes that it is possible to convert from nullptr_t to decltype(&range.begin()).
>> It also assumes that this value constructed from nullptr necessarily
>> represents an invalid value (converts to false) for that iterator type.
>>
>>
> Well, I'm pretty sure that Matthew wrote that in a hurry, and it should
> really be decltype(std::addressof(*std::begin(range)). The idea is, it is a
> pointer (how can it not be?). In which case, it can of course convert from
> nullptr_t.
>
> --
>
> ---
> 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/.
>

-- 

--- 
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/.

--001a1137d89e04f47e0507b4998a
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">&gt;=C2=A0<span style=3D"font-family:arial,sans-serif;font=
-size:13px">The idea is, it is a pointer (how can it not be?).=C2=A0</span>=
<div><span style=3D"font-family:arial,sans-serif;font-size:13px"><br></span=
></div><div><font face=3D"arial, sans-serif">It absolutely doesn&#39;t have=
 to be a pointer. We use range adaptors in our code for filtering, mapping,=
 dynamic_casting, and the like. These iterators are not pointers, and canno=
t be constructed from nullptr_t. We also have counting iterators that store=
 and increment a number, so there&#39;s not even a notion of some underlyin=
g memory location at all.</font></div><div><font face=3D"arial, sans-serif"=
><br></font></div><div><font face=3D"arial, sans-serif">A function like fir=
st_or_null which returns an optional&lt;T&amp;&gt; could probably work alri=
ght for our purposes with only a bit of extra syntax over this range-if ide=
a.=C2=A0</font></div></div><div class=3D"gmail_extra"><br><div class=3D"gma=
il_quote">On Wed, Nov 12, 2014 at 8:47 PM, Benjamin Lindley <span dir=3D"lt=
r">&lt;<a href=3D"mailto:benjameslindley@gmail.com" target=3D"_blank">benja=
meslindley@gmail.com</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_qu=
ote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex=
"><div dir=3D"ltr"><span class=3D""><br><br>On Wednesday, November 12, 2014=
 8:31:37 PM UTC-6, Brent Friedman wrote:<blockquote class=3D"gmail_quote" s=
tyle=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:=
1ex"><div dir=3D"ltr">&gt;=C2=A0<span style=3D"font-family:arial,sans-serif=
;font-size:13px">It doesn&#39;t assume that the iterators are pointers, if =
that&#39;s what you mean.</span><div><span style=3D"font-family:arial,sans-=
serif;font-size:13px">It assumes that it is possible to convert from nullpt=
r_t to=C2=A0</span><span style=3D"font-family:arial,sans-serif;font-size:13=
px">decltype(&amp;range.begin()). It also assumes that this value construct=
ed from nullptr necessarily represents an invalid value (converts to false)=
 for that iterator type.</span></div></div><div><br></div></blockquote></sp=
an><div><br>Well, I&#39;m pretty sure that Matthew wrote that in a hurry, a=
nd it should really be decltype(std::addressof(*std::begin(range)). The ide=
a is, it is a pointer (how can it not be?). In which case, it can of course=
 convert from nullptr_t.<br></div></div><div class=3D"HOEnZb"><div class=3D=
"h5">

<p></p>

-- <br>
<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 <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org" target=3D"_=
blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">http://groups.google.com/a/isocpp.org/gro=
up/std-proposals/</a>.<br>
</div></div></blockquote></div><br></div>

<p></p>

-- <br />
<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 <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 />
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 />

--001a1137d89e04f47e0507b4998a--

.
