220 19225 <8100167.A1Y3soRlXn@tjmaciei-mobl4> article
Path: news.gmane.org!not-for-mail
From: Thiago Macieira <thiago@macieira.org>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: Overloading std::begin and std::end for std::pair
Date: Thu, 23 Jul 2015 15:58:18 -0700
Lines: 40
Approved: news@gmane.org
Message-ID: <8100167.A1Y3soRlXn@tjmaciei-mobl4>
References: <012fd35d-96fd-4775-835e-2105176c4f97@isocpp.org> <e61080cb-ca1f-4426-a6be-4618ffe88cfe@isocpp.org> <792fab39-5af7-4d95-b9ba-a5cc4aed8544@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 1437692311 27010 80.91.229.3 (23 Jul 2015 22:58:31 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Thu, 23 Jul 2015 22:58:31 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCB4TK757YBRBDPDYWWQKGQELCGD3QI@isocpp.org Fri Jul 24 00:58:23 2015
Return-path: <std-proposals+bncBCB4TK757YBRBDPDYWWQKGQELCGD3QI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-wi0-f197.google.com ([209.85.212.197])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCB4TK757YBRBDPDYWWQKGQELCGD3QI@isocpp.org>)
	id 1ZIPRX-0003GH-3h
	for gclcip-std-proposals@m.gmane.org; Fri, 24 Jul 2015 00:58:23 +0200
Original-Received: by wicmv11 with SMTP id mv11sf923768wic.1
        for <gclcip-std-proposals@m.gmane.org>; Thu, 23 Jul 2015 15:58:22 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:from:to:subject:date:message-id:user-agent
         :in-reply-to:references:mime-version: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=I9oNpJV5hhOFYQ0zQlPvzb6yXRmu/b1j099NorJYn5c=;
        b=eIFTrLhVjumrO94dK+9id1vk6xYHflcmD7YS+WIlkdPa/QP0tm9iKRY/KLwUNH2z5b
         K/oLO/bxN0XyYLXEf6NJopUKmibV3/JjPC7d/tDIA7lITfwJQ7R8y3bOA28k5SEzG/a1
         tXT/uvVaTPCsCCUqnyRnnsLZcAAlrlU/MFzf4qPhG9TSTu7nu2DDfvFSSyJRcr0n0/8z
         xBqiZPHNz32btLuzkX0EwdwvH6wYhWPA/gLAXPJrtgTLFC3c9xU12/WKqGV0FqzWDkBh
         +kBP3BStXojLSRAShiNmt22S/phb9Wly36igVCqIzp+vFO91ZNH27aaL5e9mM4oaqSRM
         EK1Q= 
X-Gm-Message-State: ALoCoQlvhR+IaWRPzmtwOxehRD9l0yj2x2yF61swLSUwo15IaQub5NXGbe+obs9fg1TItpMyQNX0
X-Received: by 10.112.181.37 with SMTP id dt5mr4856460lbc.10.1437692302341;
        Thu, 23 Jul 2015 15:58:22 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.180.8.98 with SMTP id q2ls20823wia.49.canary; Thu, 23 Jul 2015
 15:58:21 -0700 (PDT)
X-Received: by 10.180.81.106 with SMTP id z10mr1063166wix.22.1437692301101;
        Thu, 23 Jul 2015 15:58:21 -0700 (PDT)
Original-Received: from gondolin.macieira.info (gondolin.macieira.info. [2a01:4f8:d13:f81:21c:14ff:fe01:12a3])
        by mx.google.com with ESMTP id fj6si663553wib.55.2015.07.23.15.58.21
        for <std-proposals@isocpp.org>;
        Thu, 23 Jul 2015 15:58:21 -0700 (PDT)
Received-SPF: pass (google.com: domain of thiago@macieira.org designates 2a01:4f8:d13:f81:21c:14ff:fe01:12a3 as permitted sender) client-ip=2a01:4f8:d13:f81:21c:14ff:fe01:12a3;
Original-Received: from tjmaciei-mobl4.localnet (jfdmzpr06-ext.jf.intel.com [134.134.137.75])
	by gondolin.macieira.info (Postfix) with ESMTPSA id E133611A54B
	for <std-proposals@isocpp.org>; Thu, 23 Jul 2015 15:58:19 -0700 (PDT)
User-Agent: KMail/4.14.9 (Linux/4.0.5-3-desktop; KDE/4.14.9; x86_64; ; )
In-Reply-To: <792fab39-5af7-4d95-b9ba-a5cc4aed8544@isocpp.org>
X-Original-Sender: thiago@macieira.org
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of thiago@macieira.org designates 2a01:4f8:d13:f81:21c:14ff:fe01:12a3
 as permitted sender) smtp.mail=thiago@macieira.org
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:19225
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/19225>

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.

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/.

.
