220 11235 <CAGNvRgArvw+NevSmdm+6hPRw=Zb1OsN3-sHSXFB7DhyDFA1wrw@mail.gmail.com> article
Path: news.gmane.org!not-for-mail
From: =?ISO-8859-1?Q?Daniel_Kr=FCgler?= <daniel.kruegler@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Lambdas - a helper function for capturing by
 const reference
Date: Wed, 11 Jun 2014 22:23:02 +0200
Lines: 41
Approved: news@gmane.org
Message-ID: <CAGNvRgArvw+NevSmdm+6hPRw=Zb1OsN3-sHSXFB7DhyDFA1wrw@mail.gmail.com>
References: <43d2122f-de4f-47c7-a70a-ce24207b813f@isocpp.org>
	<CAGg_6+O4RSiyv3q5vfBj8-S3xPrQSXkcaBhJVyS1AgbyHLcAJA@mail.gmail.com>
	<CAGNvRgBaPoNZW2Pnv8PbNYOgmPGjGi6g0eOG0T=V6NU4nyesfg@mail.gmail.com>
	<CAGg_6+Oef+ax3hKoS9kj_Ac9Cm2t2hiZSc8iR2QS7w5tXNXH=Q@mail.gmail.com>
	<CAGsORuAoxgnkiY8rZpc8YpZVZnruWmjp9607egg__mnPOTbP1g@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
X-Trace: ger.gmane.org 1402518190 18814 80.91.229.3 (11 Jun 2014 20:23:10 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Wed, 11 Jun 2014 20:23:10 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCT7RVFA4QORBJ7V4KOAKGQEKBWWZTY@isocpp.org Wed Jun 11 22:23:05 2014
Return-path: <std-proposals+bncBCT7RVFA4QORBJ7V4KOAKGQEKBWWZTY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-lb0-f198.google.com ([209.85.217.198])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCT7RVFA4QORBJ7V4KOAKGQEKBWWZTY@isocpp.org>)
	id 1Wup32-0000A0-NM
	for gclcip-std-proposals@m.gmane.org; Wed, 11 Jun 2014 22:23:04 +0200
Original-Received: by mail-lb0-f198.google.com with SMTP id u10sf172373lbd.9
        for <gclcip-std-proposals@m.gmane.org>; Wed, 11 Jun 2014 13:23:04 -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: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=6UOh1+IyRJ+KimpAlHa4ve+ywy0PUKnZtIOZzGwoxYM=;
        b=kDensGtqv113BKAL9/DDPbQ/JQwkh6DHRbs8+m3tVuibMn+5TyL/0NPOsYfzG+v6v9
         R3HUyAwqnhJfhTYF7k0en/hJQtvPe2JeZj37d5kXjDMSKTg/QSakJ944VYVXatAN/R2+
         HkBqXPQOMAnTHM8uyW7yl8XBqpRii45OAaSosCIhRRu9IqRc/otEUzEw8A4j4sD01nE/
         rPI1SZw/N/Hfwqy1uCTZerTgbHt/DHncMIkxPurqP+ULwoqrSNss1sDCayh3p7fvTOlD
         T0mM6a9L+m4GDtw3uyQDaWKQzG9mVVdPNIx2h8cZKlKZb8BXDyEQ5fxScmXULWJTwT8h
         fatw==
X-Gm-Message-State: ALoCoQnM/+tc+28xe06d+JzrkWzDaLX2NjLDFTL3VRNTdRbGCoB3ivnZby6ZC9Jh2qfHom9FTM9q
X-Received: by 10.112.14.5 with SMTP id l5mr5095593lbc.6.1402518184478;
        Wed, 11 Jun 2014 13:23:04 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.180.106.6 with SMTP id gq6ls306700wib.24.gmail; Wed, 11 Jun
 2014 13:23:02 -0700 (PDT)
X-Received: by 10.180.13.139 with SMTP id h11mr297079wic.34.1402518182888;
        Wed, 11 Jun 2014 13:23:02 -0700 (PDT)
Original-Received: from mail-wi0-x236.google.com (mail-wi0-x236.google.com [2a00:1450:400c:c05::236])
        by mx.google.com with ESMTPS id jq9si20143576wjc.24.2014.06.11.13.23.02
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Wed, 11 Jun 2014 13:23:02 -0700 (PDT)
Received-SPF: pass (google.com: domain of daniel.kruegler@gmail.com designates 2a00:1450:400c:c05::236 as permitted sender) client-ip=2a00:1450:400c:c05::236;
Original-Received: by mail-wi0-f182.google.com with SMTP id bs8so1828383wib.15
        for <std-proposals@isocpp.org>; Wed, 11 Jun 2014 13:23:02 -0700 (PDT)
X-Received: by 10.180.184.198 with SMTP id ew6mr173511wic.13.1402518182605;
 Wed, 11 Jun 2014 13:23:02 -0700 (PDT)
Original-Received: by 10.216.181.69 with HTTP; Wed, 11 Jun 2014 13:23:02 -0700 (PDT)
In-Reply-To: <CAGsORuAoxgnkiY8rZpc8YpZVZnruWmjp9607egg__mnPOTbP1g@mail.gmail.com>
X-Original-Sender: daniel.kruegler@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of daniel.kruegler@gmail.com designates 2a00:1450:400c:c05::236 as
 permitted sender) smtp.mail=daniel.kruegler@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: <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:11235
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/11235>

2014-06-11 20:33 GMT+02:00 Zhihao Yuan <zy@miator.net>:
> If applying operators of T on std::reference_wrapper<T> is a
> recommended use, then we shall never define operators as member
> function (while the standard does it everywhere).  For example:
>
>     char arr[] = "moew";
>     std::reverse_iterator<char*> x2(arr);
>     ++x2;  // good
>     auto f = [a=std::ref(x2)]
>     {
>         ++a;  // boom!
>         return a;
>     };
>
> It only works if reverse_iterator's operator++ is defined as a free
> function (for other iterators with unspecified type, implementers can
> choose which form to use, then it's a QoI; but things like
> reverse_iterator have those hardcoded in synopsis, and here is an
> observable difference).
>
> So either we need to fix the standard, or std::reference_wrapper
> is not designed to work that way (we don't want user-defined
> types to behavior differently from built-in ones).

std::reference_wrapper isn't designed to work that way. Note also that
for similar reasons (due to being an imperfect proxy), the conceptual
function INVOKE has to be adapted to automatically support
reference_wrapper objects, see

http://cplusplus.github.io/LWG/lwg-active.html#2219

- Daniel

-- 

--- 
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/.

.
