220 34950 <CAGg_6+PQ9w4Yc=LHQ8eTCSzha5dakSgeuvp91HA1QUc2h-sHxQ@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Nevin Liber <nevin@eviloverlord.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Idea about "std::pmr::memory_resource"
Date: Sun, 15 Oct 2017 13:06:06 -0500
Lines: 99
Approved: news@gmane.org
Message-ID: <CAGg_6+PQ9w4Yc=LHQ8eTCSzha5dakSgeuvp91HA1QUc2h-sHxQ@mail.gmail.com>
References: <0a8293b4-3246-47a5-9881-bc1ca4b91772@isocpp.org>
 <CAEddoJZzSZ5RROJ6Uu=2+R90mXi+hnHPDCxobrHM2daM6AxPVw@mail.gmail.com>
 <60cbae8d-2a6d-4d1b-9fdf-5c4c913ee0a0@isocpp.org> <97632d14-327a-4af6-8e55-35e753f9557c@isocpp.org>
 <18b21c5c-ab0f-51ed-1b00-d0cda5c7c046@gmail.com> <5accfbfb-91b3-489e-9e2d-b82149b5ce8e@isocpp.org>
 <4aa86771-6ade-02fa-b77e-6f0e33f230ac@gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="f403045c749cd7b794055b99c005"
X-Trace: blaine.gmane.org 1508090808 20992 195.159.176.226 (15 Oct 2017 18:06:48 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Sun, 15 Oct 2017 18:06:48 +0000 (UTC)
To: "std-proposals@isocpp.org" <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCE35H5S6IDBBOGHR3HQKGQEMD3GI3Y@isocpp.org Sun Oct 15 20:06:43 2017
Return-path: <std-proposals+bncBCE35H5S6IDBBOGHR3HQKGQEMD3GI3Y@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-pf0-f197.google.com ([209.85.192.197])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCE35H5S6IDBBOGHR3HQKGQEMD3GI3Y@isocpp.org>)
	id 1e3nJC-0004am-4m
	for gclcip-std-proposals@m.gmane.org; Sun, 15 Oct 2017 20:06:42 +0200
Original-Received: by mail-pf0-f197.google.com with SMTP id e64sf12875655pfk.0
        for <gclcip-std-proposals@m.gmane.org>; Sun, 15 Oct 2017 11:06:49 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1508090809; cv=pass;
        d=google.com; s=arc-20160816;
        b=G2diOxzFKMYI9pcQTf+XIp0IxUOjpHUdIP6AhUtKA6JPKkOgrjm7n3d0lqMjiPe13g
         Ac3opAs1qdxSfDC+HNY7nDwPiNm5nI8H79818vs6jlRm2+NwPmiMauXceATsoHjyRWv9
         L2g+2uIH6afh3pkm01HcSJlBrXr6KXlFPV8z5+7kJQWSsqj/d+SYnKRqSOPqckC2W+P5
         8BuaWXBzqWkEGJYKRAW+PRh0dtfcfnZ1woEOyXpgEje7mAhHp5TrKCxFq68VFsKNyoP8
         kM057el+4vBsYKQ9xOC8/E5LP4CuugEN+9QB0z2Sg4mOpM86whMjB1CjCT6k3UhFoIDr
         TFbg==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
         :list-id:mailing-list:precedence:reply-to:to:subject:message-id:date
         :from:references:in-reply-to:sender:mime-version
         :arc-authentication-results:arc-message-signature
         :arc-authentication-results;
        bh=6heZ0fZxcEaNk/paIsqahxXF1zVL2gs380uMNykOTrM=;
        b=0HWrKmZIqzFIAmXapgpj9lfK6bjgvS/EXzeIrTeTL89LO5aDNEdOtY4znBXqr1hmfz
         Df+2ZOSeW8jLHun7r2F7c7rl/8RHLHnVgOMdRYmGAWjJGHy9gg3OwUC8KflDsE0BTL8z
         ZdCvbW7catEtzQKHjTjm6Pcfi1AHPmC2xco/Znnz61Nq+lflbyKoOZVuEKoFpAO1FqbD
         LYni+C6z8Q1F+4QN5ctZGEobgzn4SqSc8MZPOZgTEhjpRihsYxh1VWw5QHyLltbLyuQV
         m7T0OO2rIaZmGcIibzuz7vb/NkfcG4Nm5rtOP9Dco0RQ5s60QDvllVaahj/z1uoPsOZb
         1+KA==
ARC-Authentication-Results: i=2; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=Q1R8+JYE;
       spf=pass (google.com: domain of nliber@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=nliber@gmail.com
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=6heZ0fZxcEaNk/paIsqahxXF1zVL2gs380uMNykOTrM=;
        b=pHTum6TUfc9tiMxiyAWAcsW/zAGAvWiELGTxCUOKY77mU5advNe23n4DtwZsNR8L2E
         PA9HqamHNgLWDiTPl8nOl6EjY3ahpzwLP5IckwpxMsPa1o+dRs40c+aE+ybYF0rTrn9c
         vSgzij8YXis6hofQD9KtkCTPm8ntnksfBA6vuK9URce3FNX02AXdrZ7gGZ1wgzEj8QkL
         42jJEnLVP6Qc82YrnX1ixZGZBoC726yu640uF0nqNUQUrAWKGeOfbNeHtXnhzYYEGoWI
         ke/1XZKXOkfnxutln35eYSBdXgk1xvvyO6vjKAaaKmxoWzx2bb1aCvEBQ2nI4QA2Ty7K
         A4mg==
X-Gm-Message-State: AMCzsaVQ0QZrKM2RZss7VGPF6BDaC3/yPhYoUkJTIj+qVqq3bajyvZku
	Ui7CmXip+DwRGR/MFBiN6cQ=
X-Google-Smtp-Source: AOwi7QDY1UgKgXtSOHqiz8DFTa7rYyAYPfs+V0k2amaPIJMB0KGU53WBhJBpWoHRhh8QgX4ruG4X1A==
X-Received: by 10.99.116.6 with SMTP id p6mr1709902pgc.19.1508090809092;
        Sun, 15 Oct 2017 11:06:49 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.98.163.135 with SMTP id q7ls2840151pfl.5.gmail; Sun, 15 Oct
 2017 11:06:47 -0700 (PDT)
X-Received: by 10.84.179.129 with SMTP id b1mr6899745plc.316.1508090807789;
        Sun, 15 Oct 2017 11:06:47 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1508090807; cv=none;
        d=google.com; s=arc-20160816;
        b=hQFTIuEbdkQ1ok1U0D7MC1MHvfWzezupNWnB5TY67/EdmYUQc8pkd2XUzaFR/swYb+
         qQR4HtrP1jyxMc3/hAVjLyTXP0QNKqrKnJCPg3n8j8AQ/O5MyiTWukSLbgCkeTK7eird
         TPZHVlxRjbDBTxLSNvSWSh5pJEcBERbpJdUFM3IcZji3vHplGsgSEjFdbFCTo12fHaPI
         TzOCaXlsXyLO69kW16u4QrsnnelJBGB7lzY75RfcLQUMtiecoT0psd49eU48/OlkSty+
         UPMNd67D9RaEtITfnFXVkrTwu5MuFuUpm1fagcpVENUcZuEKhet7A2Tehv7w++ehj9Kd
         ENsg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=to:subject:message-id:date:from:references:in-reply-to:sender
         :mime-version:dkim-signature:arc-authentication-results;
        bh=bvk1h708TrQrPmxt2JyOYiuO3Navpoga/xTE7esDw7A=;
        b=LPkRGzrfv+d4kY2d3WcUCPSytoL4dNBhvUtzE0zpR3hgDH6ISJPwQKv3qjVF2qZToX
         Ye80hg//BAGqncrXNYsOxFmicqtCKtLYv7/PkehWcOSz3gD22z5+iQRfFKBqyjASpzju
         qE5dab+tymwllZNCAWACpCgSVz2aPdVjb54HDFjtif9gMNJhQQgNb+QtBasDl2oGsgzh
         FZJvp5kV4URlGATTU9PL6PqGBuBgYffjOUNw8oblM1pLdSBdjqhSCc2wWaGpjzi480KJ
         b3i0SHB7Lgd3S0JsHY7rFZCi4DjuLoQQTpki5LlpM4n+3vX+pdZB8E3wiPaabXK0n5wj
         43vw==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=Q1R8+JYE;
       spf=pass (google.com: domain of nliber@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=nliber@gmail.com
Original-Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41])
        by mx.google.com with SMTPS id k65sor1088849pgc.185.2017.10.15.11.06.47
        for <std-proposals@isocpp.org>
        (Google Transport Security);
        Sun, 15 Oct 2017 11:06:47 -0700 (PDT)
Received-SPF: pass (google.com: domain of nliber@gmail.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41;
X-Received: by 10.99.112.29 with SMTP id l29mr6201264pgc.2.1508090807038; Sun,
 15 Oct 2017 11:06:47 -0700 (PDT)
Original-Sender: nliber@gmail.com
Original-Received: by 10.100.182.208 with HTTP; Sun, 15 Oct 2017 11:06:06 -0700 (PDT)
In-Reply-To: <4aa86771-6ade-02fa-b77e-6f0e33f230ac@gmail.com>
X-Original-Sender: nevin@eviloverlord.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com header.s=20161025 header.b=Q1R8+JYE;       spf=pass
 (google.com: domain of nliber@gmail.com designates 209.85.220.41 as permitted
 sender) smtp.mailfrom=nliber@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:34950
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/34950>

--f403045c749cd7b794055b99c005
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Sun, Oct 15, 2017 at 11:27 AM, Jonathan M=C3=BCller <
jonathanmueller.dev@gmail.com> wrote:

> However, for a hypothetical redesign of the standard library I think this
> should be considered.
> An allocator interface similar to the simple PMRs as opposed to the
> complexity mess that is Allocator, but instead of virtual functions and
> class hierarchy it is "concept-based" like Allocator and provides the
> possibility of using type erasure.


How do you implement a type-erased version of Allocator which can call
construct?  Please provide a link to working code.

Unfortunately, allocators have two jobs:  (1) allocate & release memory and
(2) construct and destroy objects.  They also have a major drawback in that
they have to be part of the type system (eg, vector<T, A<T>> and vector<T,
B<T>> are different types).

PMRs are about addressing (1) in such a way that using a different
allocation scheme does not require a different type family (eg, vector<T,
polymorphic_allocator<T>> is the type no matter what allocation scheme is
used).

If you or the OP has a better way to solve this with the above constraints,
present it.  If you have different constraints, well, that would be a
different proposal and it is a disservice to say that PMRs do not meet that
need because PMRs are not trying to meet that need.
--=20
 Nevin ":-)" Liber  <mailto:nevin@eviloverlord.com>  +1-847-691-1404

--=20
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 e=
mail 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/CAGg_6%2BPQ9w4Yc%3DLHQ8eTCSzha5dakSgeuvp91HA1QUc=
2h-sHxQ%40mail.gmail.com.

--f403045c749cd7b794055b99c005
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Sun, Oct 15, 2017 at 11:27 AM, Jonathan M=C3=BCller <sp=
an dir=3D"ltr">&lt;<a href=3D"mailto:jonathanmueller.dev@gmail.com" target=
=3D"_blank">jonathanmueller.dev@gmail.com</a>&gt;</span> wrote:<br><div cla=
ss=3D"gmail_extra"><div class=3D"gmail_quote"><blockquote class=3D"gmail_qu=
ote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex=
"><div class=3D"HOEnZb"><div class=3D"h5"><span style=3D"color:rgb(34,34,34=
)">However, for a hypothetical redesign of the standard library I think thi=
s should be considered.</span><br></div></div>
An allocator interface similar to the simple PMRs as opposed to the complex=
ity mess that is Allocator, but instead of virtual functions and class hier=
archy it is &quot;concept-based&quot; like Allocator and provides the possi=
bility of using type erasure.</blockquote><div><br></div><div>How do you im=
plement a type-erased version of Allocator which can call construct?=C2=A0 =
Please provide a link to working code.</div><div><br></div><div>Unfortunate=
ly, allocators have two jobs: =C2=A0(1) allocate &amp; release memory and (=
2) construct and destroy objects.=C2=A0 They also have a major drawback in =
that they have to be part of the type system (eg, vector&lt;T, A&lt;T&gt;&g=
t; and vector&lt;T, B&lt;T&gt;&gt; are different types).</div><div><br></di=
v><div>PMRs are about addressing (1) in such a way that using a different a=
llocation scheme does not require a different type family (eg, vector&lt;T,=
 polymorphic_allocator&lt;T&gt;&gt; is the type no matter what allocation s=
cheme is used).</div><div><br></div><div>If you or the OP has a better way =
to solve this with the above constraints, present it.=C2=A0 If you have dif=
ferent constraints, well, that would be a different proposal and it is a di=
sservice to say that PMRs do not meet that need because PMRs are not trying=
 to meet that need.</div></div>-- <br><div class=3D"gmail_signature" data-s=
martmail=3D"gmail_signature"><div dir=3D"ltr"><div><div dir=3D"ltr"><div>=
=C2=A0Nevin &quot;:-)&quot; Liber=C2=A0 &lt;mailto:<a href=3D"mailto:nevin@=
eviloverlord.com" target=3D"_blank">nevin@eviloverlord.com</a>&gt; =C2=A0+1=
-847-691-1404</div></div></div></div></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/CAGg_6%2BPQ9w4Yc%3DLHQ8eTCSzha5dakSge=
uvp91HA1QUc2h-sHxQ%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter"=
>https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAGg_6%2BPQ9w=
4Yc%3DLHQ8eTCSzha5dakSgeuvp91HA1QUc2h-sHxQ%40mail.gmail.com</a>.<br />

--f403045c749cd7b794055b99c005--

.
