220 34952 <70e6aa0d-f41a-440c-f0ef-4969535d08ed@gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: =?UTF-8?Q?Jonathan_M=c3=bcller?= <jonathanmueller.dev@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Idea about "std::pmr::memory_resource"
Date: Sun, 15 Oct 2017 21:12:53 +0200
Lines: 67
Approved: news@gmane.org
Message-ID: <70e6aa0d-f41a-440c-f0ef-4969535d08ed@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>
 <CAGg_6+PQ9w4Yc=LHQ8eTCSzha5dakSgeuvp91HA1QUc2h-sHxQ@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"; format=flowed
Content-Transfer-Encoding: quoted-printable
X-Trace: blaine.gmane.org 1508094783 23445 195.159.176.226 (15 Oct 2017 19:13:03 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Sun, 15 Oct 2017 19:13:03 +0000 (UTC)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
 Thunderbird/52.4.0
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCUMHC4Z6QGBBN7GR3HQKGQE3JI47ZQ@isocpp.org Sun Oct 15 21:12:59 2017
Return-path: <std-proposals+bncBCUMHC4Z6QGBBN7GR3HQKGQE3JI47ZQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-wm0-f69.google.com ([74.125.82.69])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCUMHC4Z6QGBBN7GR3HQKGQE3JI47ZQ@isocpp.org>)
	id 1e3oLA-0004LQ-Hf
	for gclcip-std-proposals@m.gmane.org; Sun, 15 Oct 2017 21:12:48 +0200
Original-Received: by mail-wm0-f69.google.com with SMTP id i124sf7727711wmf.1
        for <gclcip-std-proposals@m.gmane.org>; Sun, 15 Oct 2017 12:12:56 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1508094776; cv=pass;
        d=google.com; s=arc-20160816;
        b=AaKDDV0xWri5I2yhR+8SkohZEkXzod1VefPwF9dCv7gLAaA5ENumq9sdhA+ADbcevT
         hGCPO+N3ZptywtnlUtqP1qYvhUepFmCXjCXWYY6MuEwG35GYsjPkBXjDGwPQvDrm7pDp
         DIyO9hl2Lgkmd+X/UQmT8w/AvmCpb1H/2L84+APXoQRUhlLQ/tmwkMiLC3UCkaLqmpnV
         QfGdr4TmMk56CwQABTk2BvN0w+PH/BbZ5b9QirwhgRGs/PoLqHEryoeB67undJLyO+qt
         FQ2iuGSsN+K7flWlu5ml9OsBeCk6OV3xOx9JVgKF6fGSGlWbbCmDcYMPGxY4ed5nyGe1
         dTJQ==
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:content-transfer-encoding
         :content-language:in-reply-to:mime-version:user-agent:date
         :message-id:from:references:to:subject:arc-authentication-results
         :arc-message-signature:dkim-signature:arc-authentication-results;
        bh=iBwRi3diEFlj5P5aB07cxKsZmPKPR8JbzTlgvR1xGOc=;
        b=IpyadlyRMRLMBjDZ5HlMWzKhfDQsrHmQ7mjBhIKn6sBXWnhVOpmRnx6NnNxhxbsvVG
         xBDxFP+DIyNhJrVO17EklMSb38SWa4waFDu6EcZ3KxoQOJqDyHtXOD6t9nKt9td3nws8
         Rx0SolGgZHEGYOEHShcvG8gcOqyRIjGZ/tpZAXL5QW7EdRvOuhMaMOkXTMA561ew85w8
         2hFiQvbjm/hNYyyNDA8TV4K1Zm2Xc624WE02R8NMEUpbc+rLrwK5oRNytTst4kveOo+0
         FnKWB9y+aB9iXywA9C+Tgm0mhdfdMbHPr3fyUz1/eGvDp+xEJjZZZZoOeRElWP 
ARC-Authentication-Results: i=2; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=BpBO+nDz;
       spf=pass (google.com: domain of jonathanmueller.dev@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jonathanmueller.dev@gmail.com;
       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=subject:to:references:from:message-id:date:user-agent:mime-version
         :in-reply-to:content-language:content-transfer-encoding
         :x-original-sender:x-original-authentication-results:reply-to
         :precedence:mailing-list:list-id:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=iBwRi3diEFlj5P5aB07cxKsZmPKPR8JbzTlgvR1xGOc=;
        b=U/y1iUn6av54N1Z2nmJpIH2YhVnygzsWYxFxfazU55FMnVEr6aX6c6O3nenRfnZlQ0
         40lOnfs93oZpGmByvNIS7gHsxRtWnsNllL3xlgh/FQFfWObL3w6rUw1RMlmIo0VfM3+h
         JCth1f41M+wjJL8IYgSzuOi4clGFjgJ2P5MRnEgCfB0yVG3qzSy+AiD9P328mm1waQZd
         m/3JeXlV9zwG/lEqORVAgqsbDUmD6eKs+z7t9lJvMgMRzZDjnpLey9Rd5cuuk8hADRgj
         YJNVDjE5knjxrvIDDy7gI9+eVzPXH2GC9oXaE7o8mZjrKx3dq+tKEUqNGKFL1MBn0tiA
         q56 
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:subject:to:references:from:message-id:date
         :user-agent:mime-version:in-reply-to:content-language
         :content-transfer-encoding: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=iBwRi3diEFlj5P5aB07cxKsZmPKPR8JbzTlgvR1xGOc=;
        b=F0YiyuEjcvKYMZOJayIxoQ9TJcq7SRhYGTjVvIsFegDRTuS7gGk4H0yFmsPqn3vtil
         L40zY5oquDcPOj4pxBDaZs51AF/FljDJdAnGjePTIJ92II+T330p9LlJzaiXnzmowarv
         vFYut04UQJT+YHFSLuEz55snL2fruOakidVlc4BiP7+mHcU6vTesCQQ9+bhSp2SSw+jw
         3vFosro33ypr67ec/hGNI1kTQTECmnPuUIc53rJRtaB0jKkoz59EAtv0IQz8uL7OOxBt
         BDmBb5ejWCzd36dbEMQQqqV2vwN+SsL0bOSATinCqIa 
X-Gm-Message-State: AMCzsaWH666zzbcpm5qsjkNukBp+K/1/ZARpir87arj5vN0Wg0m7jRWf
	Y6j9d5FgAKJUuHdKW0IX3eGR2A==
X-Google-Smtp-Source: AOwi7QBXrgg5Jb0inuLjfYm9tW22nzD3BuCkjnS51+78v2Z9zpR0LUGYqbwk746tXBmPj9ysSMWSVg==
X-Received: by 10.80.182.75 with SMTP id c11mr1880319ede.4.1508094776131;
        Sun, 15 Oct 2017 12:12:56 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.80.201.70 with SMTP id p6ls5039744edh.3.gmail; Sun, 15 Oct
 2017 12:12:54 -0700 (PDT)
X-Received: by 10.80.212.208 with SMTP id e16mr10218745edj.263.1508094774809;
        Sun, 15 Oct 2017 12:12:54 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1508094774; cv=none;
        d=google.com; s=arc-20160816;
        b=rISVNvNKxaov5Fy5Umvw/mEmSoi7/v38G9Is8RnHOyo0SeDTbwJ+M1t6TLuSKG2ObM
         dqUC47OM1MRXK58o0HxZd9T2UfUSA5jB/x+3twCHzTq6nJaKm588f9Y3ln59BXGZrKEr
         S0XKsOi3+g6fg+Cw+OrVfjR9ScZ9hzO0j7G9GBArQYpyPURIv/vnFWQoQic/unOCw1XG
         W5NZ/T8yRE8C/MOQ6TI4YHwBzNy4OxzpFrHLSjbQ1UEepitPr369mnKrmRD+Z+uGZOAT
         7Z9+RVHNcvnAACocza5qapwDP5Tp49G6+6BCnuXr7E3nF6wZbHX1qeXJCa5C+TJ4kV3O
         9o4w==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=content-transfer-encoding:content-language:in-reply-to:mime-version
         :user-agent:date:message-id:from:references:to:subject
         :dkim-signature:arc-authentication-results;
        bh=ZYG/xeXDpVIa+jIUwnp6ryucswEEt+S2ttYF+Rg4GZc=;
        b=omfq7L3+N5pvItPkOvszFaDwpgp0xNJidMUp2slWZpZASpjx02JMjwn3iI9VOH0hOL
         28zA1VeeVyu1ipCsPVWWrXv6mcMOonHniSsmudV64+1i2VptwzCIvOPpDfoRBzELdGiG
         np2lFYMW09lgFNc8swdwQKZQT006CaaPZ6OwiWKh05SbpQlcIwlarshFHhH+kWMi226p
         BHUjeFIQi3PrF9KEcSXtrjoPDVbmxgoYJ+2WJJCd6AQJbrSG4Aar1sBkbq4Jpf9yayRw
         dSoby/nIFB3xp8bkiTnsJyvPye3sTgOR8y/Z/dd4YYxzmQBlYJxVD8em9Kq8uRZcFu8V
         DVmw==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=BpBO+nDz;
       spf=pass (google.com: domain of jonathanmueller.dev@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jonathanmueller.dev@gmail.com;
       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 g40sor2470690edb.22.2017.10.15.12.12.54
        for <std-proposals@isocpp.org>
        (Google Transport Security);
        Sun, 15 Oct 2017 12:12:54 -0700 (PDT)
Received-SPF: pass (google.com: domain of jonathanmueller.dev@gmail.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41;
X-Received: by 10.80.148.153 with SMTP id s25mr10101822eda.301.1508094774237;
        Sun, 15 Oct 2017 12:12:54 -0700 (PDT)
Original-Received: from [192.168.1.98] (dslb-084-060-195-012.084.060.pools.vodafone-ip.de. [84.60.195.12])
        by smtp.gmail.com with ESMTPSA id 33sm4599539edt.4.2017.10.15.12.12.53
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Sun, 15 Oct 2017 12:12:53 -0700 (PDT)
In-Reply-To: <CAGg_6+PQ9w4Yc=LHQ8eTCSzha5dakSgeuvp91HA1QUc2h-sHxQ@mail.gmail.com>
Content-Language: en-US
X-Original-Sender: jonathanmueller.dev@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com header.s=20161025 header.b=BpBO+nDz;       spf=pass
 (google.com: domain of jonathanmueller.dev@gmail.com designates 209.85.220.41
 as permitted sender) smtp.mailfrom=jonathanmueller.dev@gmail.com;
       dmarc=pass (p=NONE sp=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: <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:34952
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/34952>

On 15.10.2017 20:06, Nevin Liber wrote:
> On Sun, Oct 15, 2017 at 11:27 AM, Jonathan M=C3=BCller=20
> <jonathanmueller.dev@gmail.com <mailto:jonathanmueller.dev@gmail.com>>=20
> wrote:
>=20
>     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.
>=20
>=20
> How do you implement a type-erased version of Allocator which can call=20
> construct?=C2=A0 Please provide a link to working code.

You don't. I'm deliberately saying an allocator similar to PMRs - it=20
doesn't care about any type T, construction/destruction like the=20
Allocator do.

>=20
> Unfortunately, allocators have two jobs: =C2=A0(1) allocate & release mem=
ory=20
> and (2) construct and destroy objects.=C2=A0 They also have a major drawb=
ack=20
> in that they have to be part of the type system (eg, vector<T, A<T>> and=
=20
> vector<T, B<T>> are different types).
>=20
> PMRs are about addressing (1) in such a way that using a different=20
> allocation scheme does not require a different type family (eg,=20
> vector<T, polymorphic_allocator<T>> is the type no matter what=20
> allocation scheme is used).

I'm aware.

>=20
> If you or the OP has a better way to solve this with the above=20
> constraints, present it.=C2=A0 If you have different constraints, well, t=
hat=20
> would be a different proposal and it is a disservice to say that PMRs do=
=20
> not meet that need because PMRs are not trying to meet that need.


All I'm saying is: there are very special cases where the PMRs=20
implementation with virtual functions has unnecessary overhead.
So it would be great if there was a concept like PMRs but without the=20
need for virtual functions.

Like the OP described: You simply write a class that provides the same=20
interface and can then plug that into a container.

Yes, we already have that facility - Allocator - but Allocator also does=20
construction/destruction and is such unnecessary complex for controlling=20
memory allocation.

--=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/70e6aa0d-f41a-440c-f0ef-4969535d08ed%40gmail.com=
..

.
