220 34963 <58cdd9a2-3f73-4991-8fad-ef753634a4f0@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Aleksey Loginov <aleksey.loginov@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Idea about "std::pmr::memory_resource"
Date: Mon, 16 Oct 2017 05:17:52 -0700 (PDT)
Lines: 158
Approved: news@gmane.org
Message-ID: <58cdd9a2-3f73-4991-8fad-ef753634a4f0@isocpp.org>
References: <0a8293b4-3246-47a5-9881-bc1ca4b91772@isocpp.org>
 <07ddb1f6-d3af-43df-bf96-8975c1ab4313@isocpp.org>
 <2e191a96-1952-479b-b78b-22e31f8e03de@isocpp.org>
 <0e37b5ae-64f6-4a8a-86bd-f44b119ed40a@isocpp.org>
 <15f8c5ba-3a6a-4441-9620-92e157c66094@isocpp.org>
 <26fe4cb4-98ca-41cc-ac96-5c51851799d1@isocpp.org>
 <fee0a310-5dc5-4421-bf49-bc8fa164fe29@isocpp.org>
 <784ffce8-ace7-449d-a13d-a99d7336117a@isocpp.org>
 <d029c18a-12ee-4a7d-828c-ab1bd07b58c6@isocpp.org>
 <6d0ad98b-87d5-43dd-ac54-2b7d3e03e31b@isocpp.org>
 <72ef3209-6749-4246-9c5a-1549557ceb5a@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_168_889624143.1508156272443"
X-Trace: blaine.gmane.org 1508156289 26796 195.159.176.226 (16 Oct 2017 12:18:09 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Mon, 16 Oct 2017 12:18:09 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCGIDMXA5AJRB4OGSLHQKGQENTRWPQI@isocpp.org Mon Oct 16 14:18:00 2017
Return-path: <std-proposals+bncBCGIDMXA5AJRB4OGSLHQKGQENTRWPQI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ua0-f197.google.com ([209.85.217.197])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCGIDMXA5AJRB4OGSLHQKGQENTRWPQI@isocpp.org>)
	id 1e44L4-0004dY-Rc
	for gclcip-std-proposals@m.gmane.org; Mon, 16 Oct 2017 14:17:47 +0200
Original-Received: by mail-ua0-f197.google.com with SMTP id d44sf7783244uai.15
        for <gclcip-std-proposals@m.gmane.org>; Mon, 16 Oct 2017 05:17:54 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=C4xu+pE5xtYg/FeOevzjXWr8vtoc8ZwXeAmELPMk/BY=;
        b=kXBtXi64SX9owCa+fvPd4qkEtqrMoM/QuWe9We6oBdSQPjvciHlO0OgtQmREe+AP1N
         islHzhlXAKH64dWlS3ztiIu7ToG0bOvpxN2fXOrSYnjmZrmstDlVNjTc7JD56tqhYqUP
         piw1QRrcmRQw0dK6F3I4ru7Jv8HEMUXhg4/LTJ0PwbpqQnedJfy1EG59Z9c8pyOyUfCA
         EQVp+oknbKrXdU4F101jAq6i0cM9xBMipBvPigmx8IUSGmIxZvMvTGXIxQ9zSWPs/HyN
         9kQkZvBx45bKznuSl2MM+JcntKqmKk8Dzle9qJkgoG6waNMInB1hiZVy2Wg3B+oXx7bX
         2b7w==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=C4xu+pE5xtYg/FeOevzjXWr8vtoc8ZwXeAmELPMk/BY=;
        b=krjyeZPM7+TpftM9xDwJYczjjmUxz4y4K1vMUaEjXTX4XQT9f3+TiYQB24L+Wl7N/Y
         JpZueKWJseA2vbtlJYFwbSjCHXhLCGuSRxpPN0S8G2VoiCbRqyCuwE0w+ZcxfBpvFo1D
         S2Brqn6Tul6miUacOVZt0XpagzOpDT5admrwP4HD3Begtm35E0AFVZchgmeZT9xYvXSW
         v3CHhyOmVi6ZEonD3d/F8ulT2B7/w30HRP4GGbd6yjg8LdbfIcLGCpQJhDIfLKzxunZz
         MRXzNLCnsceWAc5KmrYzXiSOUEvFTn0nw3B+EBuzkhHl/Z6Hy/X7P3hiHNzdlp73iEbH
         MioQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:date:from:to:message-id:in-reply-to:references
         :subject:mime-version:x-original-sender:reply-to:precedence
         :mailing-list:list-id:x-spam-checked-in-group:list-post:list-help
         :list-archive:list-subscribe:list-unsubscribe;
        bh=C4xu+pE5xtYg/FeOevzjXWr8vtoc8ZwXeAmELPMk/BY=;
        b=WCRy44IygGwfAKiFGOVoQTVvWAtWyD46FlTI5IsMvXKqSYAwjMWKmtX5k2amQQBjAY
         gQWoy49nqOsMCddiqdvCtrDlkTrkaS7JxPN7wmCHOgJYAqZdHKqY8P4dZlr0jsyJr80i
         QLzf68FX1eg64PoN2PrFp0UUEVze5iAYk/jVrnZx4xnFFzoZSld2oGo89Qwap1qXMDCb
         H7VIsTnRJVM/QpdczBTtyxUQxxBUAOVjGquWKisVEA8te2+ZmGfYYFkOcgC0XkSGGUSM
         EP6ZYo7PYw9jYPPFrEWFGdj0ZHU1uRxxP9TiUpDGGBoWB3dZhkGfMuPMTbSHuYt1oAis
         B1Cg==
X-Gm-Message-State: AMCzsaUFBYWfwG+wWF81VZUNgjxRW+JR8UFR/s1dBKNB7AYccpG2mXAj
	Xsl1RYEznl9ZLvkIZhIRxBzW5Q==
X-Google-Smtp-Source: ABhQp+TuK/J944D+iBrTuDI6MQXMP3WPHQ2LJlf8EsmO/o9IPBUilvKGn5e+dxSW4C9wx7WapQYnqA==
X-Received: by 10.159.36.227 with SMTP id 90mr1391182uar.107.1508156274315;
        Mon, 16 Oct 2017 05:17:54 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.176.72.81 with SMTP id c17ls3373949uad.10.gmail; Mon, 16 Oct
 2017 05:17:53 -0700 (PDT)
X-Received: by 10.31.153.21 with SMTP id b21mr721854vke.13.1508156273013;
        Mon, 16 Oct 2017 05:17:53 -0700 (PDT)
In-Reply-To: <72ef3209-6749-4246-9c5a-1549557ceb5a@isocpp.org>
X-Original-Sender: Aleksey.Loginov@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:34963
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/34963>

------=_Part_168_889624143.1508156272443
Content-Type: multipart/alternative; 
	boundary="----=_Part_169_690657811.1508156272443"

------=_Part_169_690657811.1508156272443
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable



=D0=BF=D0=BE=D0=BD=D0=B5=D0=B4=D0=B5=D0=BB=D1=8C=D0=BD=D0=B8=D0=BA, 16 =D0=
=BE=D0=BA=D1=82=D1=8F=D0=B1=D1=80=D1=8F 2017 =D0=B3., 14:55:41 UTC+3 =D0=BF=
=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C Mingxin =
Wang=20
=D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:
>
> On Monday, October 16, 2017 at 6:55:41 PM UTC+8, Aleksey Loginov wrote:
>
>> Let's look at a more applied example:
>>
>> template<size_t Size>=20
>> struct static_resource : memory_resource { aligned_storage_t<Size> m_dat=
a
>> ; };
>>
>> template<typename MR>
>> struct my_any;
>>
>>
>> my_any<default_memory_resource> x1;
>> my_any<static_resource<32>> x2;
>>
>> x1 =3D 1;
>> x2 =3D x1;
>>
>> assert(x2 =3D=3D 1);
>>
>>
>> How can you do this without RTTI?
>>
>
> What is the semantics of `x2 =3D=3D 1`? There is no definition about=20
> `operation=3D=3D(...)` in the class `std::any`, and this expression is=20
> ill-formed if `x2` is a value of `std::any`. Do you mean that=20
> `any::operator=3D=3D(const any&)` shall be added to the standard? If so, =
I=20
> suggest that you should illustrate your motivation and provide reasonable=
=20
> semantics.
>
>
No, this is just test of result assignment (can be rewritten as any_cast<x2=
>
)
Main question is: how you can implement operator=3D without having base=20
*memory_resource *for MR.

PS: in standard it will be more useful to get inner_resource in=20
std::memory_resource for chaining (similar to *scoped_allocator_adaptor*)

--=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/58cdd9a2-3f73-4991-8fad-ef753634a4f0%40isocpp.or=
g.

------=_Part_169_690657811.1508156272443
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>=D0=BF=D0=BE=D0=BD=D0=B5=D0=B4=D0=B5=D0=BB=D1=8C=
=D0=BD=D0=B8=D0=BA, 16 =D0=BE=D0=BA=D1=82=D1=8F=D0=B1=D1=80=D1=8F 2017 =D0=
=B3., 14:55:41 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=
=D0=B5=D0=BB=D1=8C Mingxin Wang =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:=
<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;bor=
der-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">On Monday, Oc=
tober 16, 2017 at 6:55:41 PM UTC+8, Aleksey Loginov wrote:<div><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>Let&#39;s look at a more =
applied example:</div><div><br></div><div><div style=3D"background-color:rg=
b(250,250,250);border-color:rgb(187,187,187);border-style:solid;border-widt=
h:1px;word-wrap:break-word"><code><div><span style=3D"color:#008">template<=
/span><span style=3D"color:#660">&lt;</span><span style=3D"color:#000">size=
_t </span><span style=3D"color:#606">Size</span><span style=3D"color:#660">=
&gt;</span><span style=3D"color:#000"> <br></span><span style=3D"color:#008=
">struct</span><span style=3D"color:#000"> static_resource </span><span sty=
le=3D"color:#660">:</span><span style=3D"color:#000"> </span><span style=3D=
"color:rgb(34,34,34)"><span style=3D"color:#000">memory_resource </span><sp=
an style=3D"color:#660">{</span><span style=3D"color:#000"> </span></span><=
span style=3D"color:rgb(0,0,0);font-family:DejaVuSansMono,&quot;DejaVu Sans=
 Mono&quot;,courier,monospace;font-size:12.8px;white-space:nowrap;backgroun=
d-color:rgb(255,255,255)"><span style=3D"color:#000">aligned_storage_t</spa=
n><span style=3D"color:#660">&lt;</span></span><span style=3D"color:rgb(102=
,0,102);font-family:Arial,Helvetica,sans-serif">Size</span><span style=3D"c=
olor:rgb(0,0,0);font-family:DejaVuSansMono,&quot;DejaVu Sans Mono&quot;,cou=
rier,monospace;font-size:12.8px;white-space:nowrap;background-color:rgb(255=
,255,255)"><span style=3D"color:#660">&gt;</span></span><span style=3D"font=
-family:Arial,Helvetica,sans-serif"><span style=3D"color:#000"> m_data</spa=
n><span style=3D"color:#660">;</span><span style=3D"color:#000"> </span><sp=
an style=3D"color:#660">};</span></span></div><div><span style=3D"color:#00=
0"><br></span><span style=3D"color:#008">template</span><span style=3D"colo=
r:#660">&lt;</span><span><font color=3D"#000000">typename MR</font></span><=
span style=3D"color:#660">&gt;</span><span style=3D"color:#000"><br></span>=
<span style=3D"color:#008">struct</span><span style=3D"color:#000">=C2=A0my=
_any;<br><br><br>my_any&lt;default_</span><span style=3D"color:rgb(0,0,0)">=
memory_resource</span><span style=3D"color:rgb(0,0,0);font-family:Arial,Hel=
vetica,sans-serif"><wbr>&gt; x1;</span></div><div><span style=3D"color:#000=
"><span>my_any&lt;</span><span style=3D"font-family:Arial,Helvetica,sans-se=
rif">static_resource&lt;32&gt;</span><span style=3D"font-family:Arial,Helve=
tica,sans-serif">&gt; x2;</span><br><br><span style=3D"font-family:Arial,He=
lvetica,sans-serif">x1 =3D 1;<br>x2 =3D x1;<br></span><br>assert(</span><sp=
an style=3D"color:rgb(0,0,0);font-family:Arial,Helvetica,sans-serif">x2 =3D=
=3D 1</span><span style=3D"color:rgb(0,0,0);font-family:Arial,Helvetica,san=
s-serif">);</span></div><div><span style=3D"color:#000"><br></span></div></=
code></div><br></div><div>How can you=C2=A0do this without RTTI?</div></div=
></blockquote><div><br></div></div><div>What is the semantics of `x2 =3D=3D=
 1`? There is no definition about `operation=3D=3D(...)` in the class `std:=
:any`, and this expression is ill-formed if `x2` is a value of `std::any`. =
Do you mean that `any::operator=3D=3D(const any&amp;)` shall be added to th=
e standard? If so, I suggest that you should illustrate your motivation and=
 provide reasonable semantics.</div><div><br></div></div></blockquote><div>=
<br></div><div>No, this is just test of result assignment (can be rewritten=
 as=C2=A0<span class=3D"me2" style=3D"color: rgb(0, 0, 0); font-size: 12.8p=
x;">any_cast</span><span class=3D"sy1" style=3D"font-size: 12.8px; color: r=
gb(0, 0, 128);">&lt;x2</span><span class=3D"sy1" style=3D"font-size: 12.8px=
;"><font color=3D"#008000">&gt;</font></span>)</div><div>Main question is: =
how you can implement operator=3D without having base=C2=A0<span style=3D"b=
ackground-color: rgb(250, 250, 250); color: rgb(0, 0, 0); font-family: mono=
space;"><b>memory_resource=C2=A0</b></span><span style=3D"background-color:=
 rgb(250, 250, 250); color: rgb(0, 0, 0); font-family: monospace;">for MR.<=
/span></div><div><br></div><div>PS: in standard it will be more useful to g=
et inner_resource in std::memory_resource for chaining (similar to <b>scope=
d_allocator_adaptor</b>)</div><div><br></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/58cdd9a2-3f73-4991-8fad-ef753634a4f0%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/58cdd9a2-3f73-4991-8fad-ef753634a4f0=
%40isocpp.org</a>.<br />

------=_Part_169_690657811.1508156272443--

------=_Part_168_889624143.1508156272443--

.
