220 19238 <CAMSC8GNY-CQ+=nD59acZ6-qWbmNK5Fh2JjOHOq6ekxeeG3Lmdg@mail.gmail.com> article
Path: news.gmane.org!not-for-mail
From: Sasha Unknown <sasha2048@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: Overloading std::begin and std::end for std::pair
Date: Fri, 24 Jul 2015 15:50:54 +0300
Lines: 115
Approved: news@gmane.org
Message-ID: <CAMSC8GNY-CQ+=nD59acZ6-qWbmNK5Fh2JjOHOq6ekxeeG3Lmdg@mail.gmail.com>
References: <012fd35d-96fd-4775-835e-2105176c4f97@isocpp.org>
	<e61080cb-ca1f-4426-a6be-4618ffe88cfe@isocpp.org>
	<792fab39-5af7-4d95-b9ba-a5cc4aed8544@isocpp.org>
	<8100167.A1Y3soRlXn@tjmaciei-mobl4>
	<15e678b3-9b6b-4966-a7a5-1d37495fda5e@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
X-Trace: ger.gmane.org 1437742269 2064 80.91.229.3 (24 Jul 2015 12:51:09 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Fri, 24 Jul 2015 12:51:09 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCVLT44I5IDBBL7JZCWQKGQE7D2662A@isocpp.org Fri Jul 24 14:51:01 2015
Return-path: <std-proposals+bncBCVLT44I5IDBBL7JZCWQKGQE7D2662A@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+bncBCVLT44I5IDBBL7JZCWQKGQE7D2662A@isocpp.org>)
	id 1ZIcRI-0006VX-Ka
	for gclcip-std-proposals@m.gmane.org; Fri, 24 Jul 2015 14:51:00 +0200
Original-Received: by qged69 with SMTP id d69sf25445481qge.2
        for <gclcip-std-proposals@m.gmane.org>; Fri, 24 Jul 2015 05:50:58 -0700 (PDT)
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:content-type:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=o15w77BECLMS+oE/TYUN+XtEm84Myv26U/YllKyHztE=;
        b=jQ4zVbYKOatATkHUq6bLhe/nLsYIPNBU1KnNdyoTlpN9sTh9HgU2ovm6jlErUR4+ii
         /uheHraBBa1emB0DEhqYHvIFXDJnMdm/2M831LnFePH4nuslpH8Oe+7y0CkXL7cj+DNH
         AiF6HrLHYc2xAzdmDJBy3KdOecze8/uz7+9Mgtw/6rLr912oZGEWSCWlII+s/zgzXFME
         UZRxi8ghyT7uyyAguOXHK+d8Cy0iKatr/ywLHosgR2696hEsxeUaZz4dAvE1AewpVwBs
         m+7m/OzS98VnKhQUBqdrsv3AG5+iSR/wzCz7PR0EHQRFPYOje1s9uVNoL/wNBT776EIy
         lVow==
X-Gm-Message-State: ALoCoQnKxOYNPB46dKCI9mn6m3sXnZdyYAY1ozETGOEfAaVpg1gb5P2+z3KwaVFatU1Qn+IoAa0X
X-Received: by 10.129.85.86 with SMTP id j83mr14873487ywb.9.1437742258047;
        Fri, 24 Jul 2015 05:50:58 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.140.43.8 with SMTP id d8ls1545830qga.15.gmail; Fri, 24 Jul
 2015 05:50:55 -0700 (PDT)
X-Received: by 10.170.99.196 with SMTP id q187mr14626400yka.123.1437742255442;
        Fri, 24 Jul 2015 05:50:55 -0700 (PDT)
Original-Received: from mail-yk0-x231.google.com (mail-yk0-x231.google.com. [2607:f8b0:4002:c07::231])
        by mx.google.com with ESMTPS id w5si5947689ywf.213.2015.07.24.05.50.55
        for <std-proposals@isocpp.org>
        (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Fri, 24 Jul 2015 05:50:55 -0700 (PDT)
Received-SPF: pass (google.com: domain of sasha2048@gmail.com designates 2607:f8b0:4002:c07::231 as permitted sender) client-ip=2607:f8b0:4002:c07::231;
Original-Received: by ykfw194 with SMTP id w194so18657304ykf.0
        for <std-proposals@isocpp.org>; Fri, 24 Jul 2015 05:50:55 -0700 (PDT)
X-Received: by 10.129.57.193 with SMTP id g184mr14085136ywa.45.1437742255144;
 Fri, 24 Jul 2015 05:50:55 -0700 (PDT)
Original-Received: by 10.37.81.3 with HTTP; Fri, 24 Jul 2015 05:50:54 -0700 (PDT)
In-Reply-To: <15e678b3-9b6b-4966-a7a5-1d37495fda5e@isocpp.org>
X-Original-Sender: sasha2048@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of sasha2048@gmail.com designates 2607:f8b0:4002:c07::231 as permitted
 sender) smtp.mail=sasha2048@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-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:19238
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/19238>

To T. C. and Sean Middleditch: Thank you for you patience. While I
don't like the this proposal of Vlad from Moscow for many reasons, I
appreciate patience and level of detail in your responses. At some
point in future these patience and detail-level may save some good but
ugly-looking proposal.

To Vlad from Moscow:
1. Just to satisfy my interest: Aren't you coming to C++ from some
dynamically-typed language?
2. If n2995 and/or D4128 would be accepted, they will satisfy all your requests:
    for ( auto x : std::make_range( a + 3, a + 7 ) ) ...;
    for ( auto p : m.equal_range( 'A' ) ) ...;

On Fri, Jul 24, 2015 at 10:36 AM, Vlad from Moscow <vlad.moscow@mail.ru> wrote:
>
>
> On Friday, July 24, 2015 at 1:58:22 AM UTC+3, Thiago Macieira wrote:
>>
>> On Thursday 23 July 2015 12:31:59 Vlad from Moscow wrote:
>> > Could you explain why do I need some ranges when this program looks
>> > clear
>> > and nice without any ranges?
>>
>> Because you made it so that std::pair<T, T> is always a range, but that
>> isn't
>> the case. In fact, I'd argue that most people who think of "iterating"
>> over a
>> pair expect it to behave as an array of two elements: the first and the
>> second.
>>
>
> There is a serious logical mistake. If for example two pointers can make up
> a range this does not mean that any two pointers is a range or that any
> range is two pointers. Even two iterators of the same container or two
> pointers of the same array might not make a range.
>
> std::pair is simply a media that can store iterators. It is used in
> algorithm std::mismatch where iterators does not make up a range or in the
> algorithm or class methods  equal_range where pointers make up a range.
>
> It is a responsibility of the programmer to use appropriate iterators that
> are stored in the media.
>
> So you and Sean Middleditch attempts to substitute the meaning of  std::pair
> for the role like just ranges are false and confuse programmers.
> It is responsibility of the programmer to correctly use std::pair in
> different situations.
>
> With the same success you can use any valid C++ construction incorrectly.
> For example you can return a reference to a local variable of a function.
> Does it mean that something wrong with references and the programmers shall
> not declare function return types as references?
>
> According to your false logic it follows that the programmers indeed shall
> not declare function return types as references
>
> The ptoblem is why should the programmer pay for the means that he totally
> need not?
>
> I showed already an example with std::multimap where the code looks clear
> and nice. But you are saying: "Stop! Programs must not be so clear and nice.
> You have to declare a class hierarchy and use these additional classes to do
> a simple and entirely correct thing."
>
> Why do the programmer have to use a suoerstructure when he already has a
> range that he stored on such a media like std::pair?
>
> And moreover now Sean Middleditch is even going to deform standard
> algorithms with the only purpose that all programmers used his useless
> superstructures where all can be done simply and clear without them.
>
>
>> I'd expect:
>>
>> template<typename T> const T* begin(const pair<T, T> &p)
>> { return &p.first; }
>>
>> template<typename T> const T *end(const pair<T, T> &p)
>> { return &p.second + 1; }
>>
>> Which allows me to run:
>>
>> int main()
>> {
>>         for (auto i : std::make_pair(1, 2))
>>                 cout << i << ' ';
>>         cout << endl;
>> }
>>
>> output: 1 2
>> --
>> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
>>    Software Architect - Intel Open Source Technology Center
>>       PGP/GPG: 0x6EF45358; fingerprint:
>>       E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
>>
> --
>
> ---
> 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/.

.
