220 19213 <88e7af16-11e2-41a1-85f8-9e70003dff48@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: Vlad from Moscow <vlad.moscow@mail.ru>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Overloading std::begin and std::end for std::pair
Date: Thu, 23 Jul 2015 12:18:04 -0700 (PDT)
Lines: 126
Approved: news@gmane.org
Message-ID: <88e7af16-11e2-41a1-85f8-9e70003dff48@isocpp.org>
References: <012fd35d-96fd-4775-835e-2105176c4f97@isocpp.org>
 <e61080cb-ca1f-4426-a6be-4618ffe88cfe@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_759_905092172.1437679084352"
X-Trace: ger.gmane.org 1437679087 12835 80.91.229.3 (23 Jul 2015 19:18:07 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Thu, 23 Jul 2015 19:18:07 +0000 (UTC)
Cc: sean.middleditch@gmail.com
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCXLLRHD7IDRB3P3YSWQKGQE5HEJJDA@isocpp.org Thu Jul 23 21:18:07 2015
Return-path: <std-proposals+bncBCXLLRHD7IDRB3P3YSWQKGQE5HEJJDA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-qg0-f70.google.com ([209.85.192.70])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCXLLRHD7IDRB3P3YSWQKGQE5HEJJDA@isocpp.org>)
	id 1ZIM0M-0000bc-OY
	for gclcip-std-proposals@m.gmane.org; Thu, 23 Jul 2015 21:18:06 +0200
Original-Received: by qgeu79 with SMTP id u79sf1938555qge.1
        for <gclcip-std-proposals@m.gmane.org>; Thu, 23 Jul 2015 12:18:05 -0700 (PDT)
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:content-type: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=HRJchb29oHktEPoB4CTw54iuvpwsywsNyHSIYWw+Zng=;
        b=hk63ELSsda3zVybP023l8fPIm7ehsy+MKjlKrRG2ZcLq6fGyQ+z2nZYZMZrNYfXo8D
         dFR3Q6D51HhxgFHxNr9jmn5BwMjXGWlT1uVlZYcRQXk4yUIDpbk0FCG1PyYrfjy1nU2P
         EpZf9HklZ8PSsgnzakc9sc7I9FiYIqbRDKRW5nNpD8u1DW801c2w25tE1TnFRYQg2X8G
         cg8vbSSHSLFUWzLZHGZfWCRz7PXZHPyAevRz/E4r0jtEQEFeYa2qF20wMudgD0GMaRkh
         LXjqUP57e5RdHQ9rU+9+U+FqRBK5A5FBD4aopyafhdTNuca8aOOpaBR0LbqW/ctkgzTF
         cseg==
X-Gm-Message-State: ALoCoQlucznw+AuVei8Gy0vKQ7ACM/8a3C8HluvLrXoEkbIf9HmkmBMH/Amh6gA4lXcyxZKgjcJR
X-Received: by 10.13.244.2 with SMTP id d2mr10048452ywf.34.1437679085824;
        Thu, 23 Jul 2015 12:18:05 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.140.39.84 with SMTP id u78ls1243838qgu.31.gmail; Thu, 23 Jul
 2015 12:18:05 -0700 (PDT)
X-Received: by 10.140.101.243 with SMTP id u106mr222949qge.27.1437679085084;
        Thu, 23 Jul 2015 12:18:05 -0700 (PDT)
In-Reply-To: <e61080cb-ca1f-4426-a6be-4618ffe88cfe@isocpp.org>
X-Original-Sender: vlad.moscow@mail.ru
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Spam-Checked-In-Group: 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:19213
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/19213>

------=_Part_759_905092172.1437679084352
Content-Type: multipart/alternative; 
	boundary="----=_Part_760_1532103494.1437679084353"

------=_Part_760_1532103494.1437679084353
Content-Type: text/plain; charset=UTF-8

There is nothing solved by ranges. I would prefer to use what I already 
have that  is std::pair. I do not need for such tasks new compound classes 
as ranges. 

And as far as I know array_view does not work with for examples std::map.

On Thursday, July 23, 2015 at 10:04:27 PM UTC+3, Sean Middleditch wrote:

> This is solved by ranges (there's a proposal in flight derived from 
> https://github.com/ericniebler/range-v3). You're trying to treat 
> std::pair<iterator, iterator> as a range between the two iterators, which 
> is not semantically correct for all possible pairs of iterators. I'd rather 
> just leave pair alone and let the ranges proposal solve this by replacing 
> the handle of STL uses of pair<iterator, iterator> with a range<iterator>.
>
> In your example it's also solved by array_view, which is really just a 
> form of range.
>
> An additional nice thing about the ranges is that begin, end, size, 
> operator[], etc. can all be added to the range type as member functions (as 
> appropriate for the iterator category).
>
> On Thursday, July 23, 2015 at 10:36:46 AM UTC-7, Vlad from Moscow wrote:
>>
>> I'd like to  suggest very simple and at the same time very useful  
>> overloaded functions std::begin and std::end for standard class std::pair.
>>
>> Here is a demonstrative program of the idea
>>
>> #include <iostream>
>> #include <utility>
>>
>> namespace std
>> {    
>> template <class Iterator>
>> Iterator begin( const std::pair<Iterator, Iterator> &p )
>> {
>>     return p.first;
>> }
>> template <class Iterator>
>> Iterator end( const std::pair<Iterator, Iterator> &p )
>> {
>>     return p.second;
>> }
>> }
>>
>

-- 

--- 
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_760_1532103494.1437679084353
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>There is nothing solved by ranges. I would prefer to =
use what I already have that=C2=A0 is std::pair. I do not need for such tas=
ks new compound classes as ranges. <br></div><div><br></div><div>And as far=
 as I know array_view does not work with for examples std::map.</div><div><=
br>On Thursday, July 23, 2015 at 10:04:27 PM UTC+3, Sean Middleditch wrote:=
</div><blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex;=
 padding-left: 1ex; border-left-color: rgb(204, 204, 204); border-left-widt=
h: 1px; border-left-style: solid;"><div dir=3D"ltr">This is solved by range=
s (there&#39;s a proposal in flight derived from <a onmousedown=3D"this.hre=
f=3D&#39;https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2Fericnieb=
ler%2Frange-v3\46sa\75D\46sntz\0751\46usg\75AFQjCNF6-7MwmERsjtO_yikBxBOgeh0=
fkA&#39;;return true;" onclick=3D"this.href=3D&#39;https://www.google.com/u=
rl?q\75https%3A%2F%2Fgithub.com%2Fericniebler%2Frange-v3\46sa\75D\46sntz\07=
51\46usg\75AFQjCNF6-7MwmERsjtO_yikBxBOgeh0fkA&#39;;return true;" href=3D"ht=
tps://github.com/ericniebler/range-v3" target=3D"_blank" rel=3D"nofollow">h=
ttps://github.com/ericniebler/range-v3</a>). You&#39;re trying to treat std=
::pair&lt;iterator, iterator&gt; as a range between the two iterators, whic=
h is not semantically correct for all possible pairs of iterators. I&#39;d =
rather just leave pair alone and let the ranges proposal solve this by repl=
acing the handle of STL uses of pair&lt;iterator, iterator&gt; with a range=
&lt;iterator&gt;.<div><br></div><div>In your example it&#39;s also solved b=
y array_view, which is really just a form of range.<br><div><br></div><div>=
An additional nice thing about the ranges is that begin, end, size, operato=
r[], etc. can all be added to the range type as member functions (as approp=
riate for the iterator category).<br><br>On Thursday, July 23, 2015 at 10:3=
6:46 AM UTC-7, Vlad from Moscow wrote:<blockquote class=3D"gmail_quote" sty=
le=3D"margin: 0px 0px 0px 0.8ex; padding-left: 1ex; border-left-color: rgb(=
204, 204, 204); border-left-width: 1px; border-left-style: solid;"><div dir=
=3D"ltr"><div>I&#39;d like to =C2=A0suggest very simple and=C2=A0at the sam=
e time very useful=C2=A0 overloaded functions std::begin and std::end for s=
tandard class std::pair.</div><div><br></div><div>Here is a demonstrative p=
rogram of the idea</div><div><br></div><div>#include &lt;iostream&gt;</div>=
<div>#include &lt;utility&gt;</div><div><br></div><div>namespace std<br>{=
=C2=A0=C2=A0=C2=A0 <br>template &lt;class Iterator&gt;<br>Iterator begin( c=
onst std::pair&lt;Iterator, Iterator&gt; &amp;p )<br>{<br>=C2=A0=C2=A0=C2=
=A0 return p.first;<br>}</div><div>template &lt;class Iterator&gt;<br>Itera=
tor end( const std::pair&lt;Iterator, Iterator&gt; &amp;p )<br>{<br>=C2=A0=
=C2=A0=C2=A0 return p.second;<br>}<br>}</div></div></blockquote></div></div=
></div></blockquote></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 />

------=_Part_760_1532103494.1437679084353--
------=_Part_759_905092172.1437679084352--

.
