220 31766 <CALQmNFgAe4B2tiqjA7Mq1TWXWdt-OMAUD41AKzuxh_6_X=uRcQ@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Sean Middleditch <sean@middleditch.us>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: Complexities caused by using unique_ptr and
 move semantics
Date: Sun, 26 Mar 2017 15:11:06 -0700
Lines: 137
Approved: news@gmane.org
Message-ID: <CALQmNFgAe4B2tiqjA7Mq1TWXWdt-OMAUD41AKzuxh_6_X=uRcQ@mail.gmail.com>
References: <46a85060-631b-49e5-94f3-ab07429d8085@isocpp.org>
 <86aeb556-e0d7-4d68-b553-1b4163461473@isocpp.org> <136fc743-bc63-48c8-b1d5-dc4084dd13cf@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary=001a113567bed6a331054ba980bf
X-Trace: blaine.gmane.org 1490566270 2924 195.159.176.226 (26 Mar 2017 22:11:10 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Sun, 26 Mar 2017 22:11:10 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCDODCNR2QPRB67Y4DDAKGQEEHV2DII@isocpp.org Mon Mar 27 00:11:06 2017
Return-path: <std-proposals+bncBCDODCNR2QPRB67Y4DDAKGQEEHV2DII@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-qt0-f197.google.com ([209.85.216.197])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCDODCNR2QPRB67Y4DDAKGQEEHV2DII@isocpp.org>)
	id 1csGNK-0008P0-LX
	for gclcip-std-proposals@m.gmane.org; Mon, 27 Mar 2017 00:11:02 +0200
Original-Received: by mail-qt0-f197.google.com with SMTP id h56sf33828986qtc.10
        for <gclcip-std-proposals@m.gmane.org>; Sun, 26 Mar 2017 15:11:08 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:mime-version:sender:in-reply-to:references:from
         :date:message-id:subject:to: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=hpcPh1EzdPrwOBQ/IKiSYp1vHcHqCj+dlKalqShwbgM=;
        b=V+RDmqLU4OlBbh3+1h2fqgW2/D7Ohg3kohksnufZO/MDO+fTjEf0Z7coCeANNH5ARZ
         MBAPQ3oM5nqhGGcb2XT6qm8rJ/Z4LkBOU+1uJWWoz45xV26qSBg4+FLsTe2IXsJQ4wrH
         NyoQ5qJqZBQyDQTG1mn3sHfq4VnqE8nYUcYkvW88owpl5BcZ1/U4rZKp/dJp8T6BFv5N
         qJxI33qeAlmxdexb2p0MGXLLlNbgjMvvS8goYdydNBFKScmIDkvQAbeF1k3vKB6biTX4
         USH6epT6dkagS2JZftFRuPt8HptwLM2w5U6/WY2fdIs3UG9wiwO+QIOPbAtuSRC6Ja+B
         fYXw==
X-Gm-Message-State: AFeK/H1WOeaFTGD8Bkt6R1wF/HuTqSStvfmM6Vy+SMgCOzXtUM7wqJlW/1jptCKmZNaIMw==
X-Received: by 10.200.50.241 with SMTP id a46mr6158113qtb.13.1490566268083;
        Sun, 26 Mar 2017 15:11:08 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.157.35.166 with SMTP id t35ls4641186otb.11.gmail; Sun, 26 Mar
 2017 15:11:07 -0700 (PDT)
X-Received: by 10.200.44.156 with SMTP id 28mr18499552qtw.48.1490566267149;
        Sun, 26 Mar 2017 15:11:07 -0700 (PDT)
Original-Received: from mail-qt0-x22c.google.com (mail-qt0-x22c.google.com. [2607:f8b0:400d:c0d::22c])
        by mx.google.com with ESMTPS id 202si8102611qkm.327.2017.03.26.15.11.07
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Sun, 26 Mar 2017 15:11:07 -0700 (PDT)
Received-SPF: pass (google.com: domain of sean.middleditch@gmail.com designates 2607:f8b0:400d:c0d::22c as permitted sender) client-ip=2607:f8b0:400d:c0d::22c;
Original-Received: by mail-qt0-x22c.google.com with SMTP id n21so24677950qta.1
        for <std-proposals@isocpp.org>; Sun, 26 Mar 2017 15:11:07 -0700 (PDT)
X-Received: by 10.200.44.138 with SMTP id 10mr19350147qtw.12.1490566266657;
 Sun, 26 Mar 2017 15:11:06 -0700 (PDT)
Original-Sender: sean.middleditch@gmail.com
Original-Received: by 10.237.47.65 with HTTP; Sun, 26 Mar 2017 15:11:06 -0700 (PDT)
In-Reply-To: <136fc743-bc63-48c8-b1d5-dc4084dd13cf@isocpp.org>
X-Original-Sender: sean@middleditch.us
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com;       spf=pass (google.com: domain of
 sean.middleditch@gmail.com designates 2607:f8b0:400d:c0d::22c as permitted
 sender) smtp.mailfrom=sean.middleditch@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: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://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>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:31766
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/31766>

--001a113567bed6a331054ba980bf
Content-Type: text/plain; charset=UTF-8

On Fri, Mar 24, 2017 at 3:25 PM, Nicol Bolas <jmckesson@gmail.com> wrote:

>
>> Basically, you want to write something like:
>>
>>   iterable<T&> foo::get_things() { return make_iterable(_things, [](auto&
>> p){ return *p; }); }
>>
>>
> That's a really bad tradeoff: type-erasing performance plus the cost of
> filtering, all just to gain some increased genericity.
>

Not at all, because that'd be a template that gets fully inlined and result
in identical machine code (assuming a suitably capable optimizer). Again,
that's all writeable _today_ if you put in the leg work (we have in our
libraries), it's just not a standard pattern in the C++ libraries, and you
don't get the niceties that concepts provides wrt errors and composition.

Generators and mapped iterables aren't new here, just like C++ lambdas
weren't new - they're just syntactic sugar for a well-established pattern.


>
> But Boost.Range already has something like this: `any_range
> <http://www.boost.org/doc/libs/1_63_0/libs/range/doc/html/range/reference/ranges/any_range.html>`,
> coupled with transforming the input range by a function
> <http://www.boost.org/doc/libs/1_63_0/libs/range/doc/html/range/reference/adaptors/reference/transformed.html>
> .
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this topic, visit https://groups.google.com/a/
> isocpp.org/d/topic/std-proposals/nc5Sj-LtKbA/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> std-proposals+unsubscribe@isocpp.org.
> To post to this group, send email to std-proposals@isocpp.org.
> To view this discussion on the web visit https://groups.google.com/a/
> isocpp.org/d/msgid/std-proposals/136fc743-bc63-48c8-
> b1d5-dc4084dd13cf%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/136fc743-bc63-48c8-b1d5-dc4084dd13cf%40isocpp.org?utm_medium=email&utm_source=footer>
> .
>



-- 
Sean Middleditch
http://seanmiddleditch.com

-- 
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.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CALQmNFgAe4B2tiqjA7Mq1TWXWdt-OMAUD41AKzuxh_6_X%3DuRcQ%40mail.gmail.com.

--001a113567bed6a331054ba980bf
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote">On F=
ri, Mar 24, 2017 at 3:25 PM, Nicol Bolas <span dir=3D"ltr">&lt;<a href=3D"m=
ailto:jmckesson@gmail.com" target=3D"_blank">jmckesson@gmail.com</a>&gt;</s=
pan> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex=
;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><span class=
=3D""><blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex=
;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div><br></d=
iv><div>Basically, you want to write something like:</div><div><br></div><d=
iv>=C2=A0 iterable&lt;T&amp;&gt; foo::get_things() { return make_iterable(_=
things, [](auto&amp; p){ return *p; }); }<br></div><div><br></div><div></di=
v></div></blockquote></span><div><br>That&#39;s a really bad tradeoff: type=
-erasing performance plus the cost of filtering, all just to gain some incr=
eased genericity. <br></div></div></blockquote><div><br></div><div>Not at a=
ll, because that&#39;d be a template that gets fully inlined and result in =
identical machine code (assuming a suitably capable optimizer). Again, that=
&#39;s all writeable _today_ if you put in the leg work (we have in our lib=
raries), it&#39;s just not a standard pattern in the C++ libraries, and you=
 don&#39;t get the niceties that concepts provides wrt errors and compositi=
on.</div><div><br></div><div>Generators and mapped iterables aren&#39;t new=
 here, just like C++ lambdas weren&#39;t new - they&#39;re just syntactic s=
ugar for a well-established pattern.</div><div>=C2=A0</div><blockquote clas=
s=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;pad=
ding-left:1ex"><div dir=3D"ltr"><div><br>But Boost.Range already has someth=
ing like this: `<a href=3D"http://www.boost.org/doc/libs/1_63_0/libs/range/=
doc/html/range/reference/ranges/any_range.html" target=3D"_blank">any_range=
</a>`, coupled with <a href=3D"http://www.boost.org/doc/libs/1_63_0/libs/ra=
nge/doc/html/range/reference/adaptors/reference/transformed.html" target=3D=
"_blank">transforming the input range by a function</a>.<br></div></div><sp=
an class=3D"">

<p></p>

-- <br>
You received this message because you are subscribed to a topic in the Goog=
le Groups &quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this topic, visit <a href=3D"https://groups.google.com/=
a/isocpp.org/d/topic/std-proposals/nc5Sj-LtKbA/unsubscribe" target=3D"_blan=
k">https://groups.google.com/a/<wbr>isocpp.org/d/topic/std-<wbr>proposals/n=
c5Sj-LtKbA/<wbr>unsubscribe</a>.<br>
To unsubscribe from this group and all its topics, send an email to <a href=
=3D"mailto:std-proposals+unsubscribe@isocpp.org" target=3D"_blank">std-prop=
osals+unsubscribe@<wbr>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></span>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/136fc743-bc63-48c8-b1d5-dc4084dd13cf%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" target=3D"_blank">=
https://groups.google.com/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/136f=
c743-bc63-48c8-<wbr>b1d5-dc4084dd13cf%40isocpp.org</a><wbr>.<br>
</blockquote></div><br><br clear=3D"all"><div><br></div>-- <br><div class=
=3D"gmail_signature" data-smartmail=3D"gmail_signature">Sean Middleditch<br=
><a href=3D"http://seanmiddleditch.com" target=3D"_blank">http://seanmiddle=
ditch.com</a></div>
</div></div>

<p></p>

-- <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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CALQmNFgAe4B2tiqjA7Mq1TWXWdt-OMAUD41A=
Kzuxh_6_X%3DuRcQ%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CALQmNFgAe4B2ti=
qjA7Mq1TWXWdt-OMAUD41AKzuxh_6_X%3DuRcQ%40mail.gmail.com</a>.<br />

--001a113567bed6a331054ba980bf--

.
