220 38737 <17d39779-2bb9-4073-ab3f-4b14eef2d0de@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Charles Salvia <charles.a.salvia@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Proposal for generic rebind template
Date: Tue, 19 Jun 2018 14:57:35 -0700 (PDT)
Lines: 155
Approved: news@gmane.org
Message-ID: <17d39779-2bb9-4073-ab3f-4b14eef2d0de@isocpp.org>
References: <824bd50b-55f9-4ca5-b17f-db5ba21245dd@isocpp.org>
 <CAM76qmvuEgiO-NXjNMesTJuRnMpx4=ueot7i_RL27UY_WbiO3w@mail.gmail.com>
 <eefbbc29-477c-403c-8cc1-361a17dc2653@isocpp.org>
 <7f5b55e9-e935-421a-b0ab-3b5cbbb1c624@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_26529_1560161599.1529445456186"
X-Trace: blaine.gmane.org 1529445333 28311 195.159.176.226 (19 Jun 2018 21:55:33 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Tue, 19 Jun 2018 21:55:33 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBDY6DLOFSEPBBUPYUXMQKGQEBI2X6AY@isocpp.org Tue Jun 19 23:55:29 2018
Return-path: <std-proposals+bncBDY6DLOFSEPBBUPYUXMQKGQEBI2X6AY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yb0-f197.google.com ([209.85.213.197])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDY6DLOFSEPBBUPYUXMQKGQEBI2X6AY@isocpp.org>)
	id 1fVOb1-0007F6-5g
	for gclcip-std-proposals@m.gmane.org; Tue, 19 Jun 2018 23:55:27 +0200
Original-Received: by mail-yb0-f197.google.com with SMTP id q12-v6sf661522ybp.11
        for <gclcip-std-proposals@m.gmane.org>; Tue, 19 Jun 2018 14:57:38 -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=kvOLCrcG54bz6wZ61L+s886B9vL87d7rxhBj09pbcSk=;
        b=aRBLMH7hTLj01hOcM6NWb8wRhls9JUH0e7YcZNubp6NwkwUBKGtXamEgnhBtQmZbgf
         234xRD9aIkzXyLJlNQhkl8RfBmFWKmcaP2/MgdkFfcRG7oUtH4hAAk6IhWp7fBskOWQY
         jCu8/UgeWZBhWfuhN5wvqrgjypyFHO+p/Fe2J3uO3hXdwVEcpikGGPPmt8tM6eQH9fak
         yvc32jzCt9h0KNGJ2LltHYFOrhG+Vc36Jkix9beMhSzzbW4rEI0c/tOtXg8g4MS/Cq09
         tmuZ7z/5pqkgTV6Y+EgGpi8Sx7IJpsnQ0EiblrbSVu9PMvTcyUTKJHYqVX/4xiiNQ+Ax
         +DZw==
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=kvOLCrcG54bz6wZ61L+s886B9vL87d7rxhBj09pbcSk=;
        b=Bwlti/Z78WZzE/8EeKvY8kS9lVIdP42Ar5R9AUvdtWrvwxwbBS6/wEaeuFaXrzhqh+
         Jk9DQN6LldvNnrKEdSQxH2ORdjBXGRjEznjF//5EKX9ZL68b9QH0KRixonp+jPdLPGWI
         47TrE/ObSideQIXxwlTzHo0VCNZjJzqChSSUxnZD70PnZPNM9Wy4a1kRpFcaDvCGHIy7
         ixyQFrORmZuc+wSP0y4uFnGbRB2HeTZjygTzNnNQVEwUlG797ZaWKAarSJyPacC/GlMz
         nVB5j7A+aBpa53NpkQk0BomUOLT7Ag+e+bERtjnQ08+xWfRM5EC0exmav+bN1qEMZg4J
         yQRg==
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=kvOLCrcG54bz6wZ61L+s886B9vL87d7rxhBj09pbcSk=;
        b=A9IVNv1SanS0nFslHS2pr3xKY9NCCWxI0pjUJnuIrb4sZ0JfI4BaLSxChPxo/nVf6e
         0NfxhhT/cNaf2HiSVBaAxq+1IAoExzDmpUFflKNbGOzYo2olVx2X1AkjHmKHIjHkl3bG
         zd8HQfqwvB147xIJCIU+U8qLoTkdcIKFmzAYhAR2ooFwM33EZb5DTJOt+lbs5+B7bs6Q
         BDpDm5Z8SyofwCmbjnZdLswb0miqxNVu9xizcgnC4Efvyy5B+hdrnIxAlKcAp/wh9GqR
         /NEi/tj9tO5JFMkWj96i0intk/dvxVvQmvGsmuNNcnjMfsjUWiAwyxR2mqAqM1XVSsIq
         VxAA==
X-Gm-Message-State: APt69E0ff/1D0wCScGntDZR3z1BTp94VMpBfgw/GgJiLeEAyob5ZBUBe
	Bd1xtozIP+oWAsHvFe12mgm6Jg==
X-Google-Smtp-Source: ADUXVKL1yzUHF6hcgbXnxsJyetfwKtgwIkJfYWycOfj82984GgaruwjAmiNYBD/kIWw2abkVVGDvjA==
X-Received: by 2002:a25:5d08:: with SMTP id r8-v6mr5114570ybb.64.1529445458102;
        Tue, 19 Jun 2018 14:57:38 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 2002:a25:44c:: with SMTP id 73-v6ls204625ybe.11.gmail; Tue, 19
 Jun 2018 14:57:37 -0700 (PDT)
X-Received: by 2002:a5b:10c:: with SMTP id 12-v6mr210060ybx.1.1529445456835;
        Tue, 19 Jun 2018 14:57:36 -0700 (PDT)
In-Reply-To: <7f5b55e9-e935-421a-b0ab-3b5cbbb1c624@isocpp.org>
X-Original-Sender: charles.a.salvia@gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Spam-Checked-In-Group: 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:38737
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/38737>

------=_Part_26529_1560161599.1529445456186
Content-Type: multipart/alternative; 
	boundary="----=_Part_26530_1758866658.1529445456187"

------=_Part_26530_1758866658.1529445456187
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Right.  In that case it wouldn't do the expected thing, because=20
std::pmr::vector is defined as an alias template rather than a class=20
template.

On Tuesday, June 19, 2018 at 1:20:10 PM UTC-4, Arthur O'Dwyer wrote:
>
> On Monday, June 18, 2018 at 9:03:12 AM UTC-7, Charles Salvia wrote:
>>
>> *Updated draft proposal for generic rebind template:*
>>
>> http://charles-salvia.github.io/CPP-REBIND-PROPOSAL.html
>>
>> Implementation files:
>>
>> https://github.com/charles-salvia/std-proposal-generic-template-rebind=
=20
>> <https://www.google.com/url?q=3Dhttps%3A%2F%2Fgithub.com%2Fcharles-salvi=
a%2Fstd-proposal-generic-template-rebind&sa=3DD&sntz=3D1&usg=3DAFQjCNFd63xm=
UN5MQyW_aWJBKDNIE-w9NA>
>>
>> This is a proposal to create a generic mechanism for rebinding template=
=20
>> parameters (std::rebind_t), to remove the need for ad-hoc rebind templat=
es,=20
>> such as std::allocator_traits::rebind_alloc, etc.=20
>>
>
> This is a bad idea for several philosophical reasons (and I say that as=
=20
> the presenter of this talk <https://www.youtube.com/watch?v=3D0MdSJsCTRkY=
>=20
> on a similar subject. The difference is that I don't want any "generic"=
=20
> rebind facility, I just want a greater number of special-purpose rebinder=
s).
>
> However, your idea doesn't work anyway. Try it on some library types:
>
>     using V =3D std::pmr::vector<int>;
>     using W =3D rebind_t<V, double>;
>     static_assert(std::is_same_v<W, std::pmr::vector<double>>);  // error=
!
>
> Since it's a bad idea *and* doesn't work, I think you should give it up.
>
> However, it's also much easier to implement as a pure library extension=
=20
> than you thought it was. I can do it in 28 lines and I bet it can be done=
=20
> in fewer.
> https://wandbox.org/permlink/pRIQ8lJaf8irznwK
>
> =E2=80=93Arthur
>

--=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/17d39779-2bb9-4073-ab3f-4b14eef2d0de%40isocpp.or=
g.

------=_Part_26530_1758866658.1529445456187
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Right.=C2=A0 In that case it wouldn&#39;t do the expected =
thing, because std::pmr::vector is defined as an alias template rather than=
 a class template.<br><br>On Tuesday, June 19, 2018 at 1:20:10 PM UTC-4, Ar=
thur O&#39;Dwyer wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0=
;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div di=
r=3D"ltr">On Monday, June 18, 2018 at 9:03:12 AM UTC-7, Charles Salvia wrot=
e:<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"><b>Updated draft=
 proposal for generic rebind template:</b><div><br></div><div><a href=3D"ht=
tp://charles-salvia.github.io/CPP-REBIND-PROPOSAL.html" rel=3D"nofollow" ta=
rget=3D"_blank" onmousedown=3D"this.href=3D&#39;http://www.google.com/url?q=
\x3dhttp%3A%2F%2Fcharles-salvia.github.io%2FCPP-REBIND-PROPOSAL.html\x26sa\=
x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHCRbK1gu_d1Sr0hoqq7swlsWak1g&#39;;return =
true;" onclick=3D"this.href=3D&#39;http://www.google.com/url?q\x3dhttp%3A%2=
F%2Fcharles-salvia.github.io%2FCPP-REBIND-PROPOSAL.html\x26sa\x3dD\x26sntz\=
x3d1\x26usg\x3dAFQjCNHCRbK1gu_d1Sr0hoqq7swlsWak1g&#39;;return true;">http:/=
/charles-salvia.github.<wbr>io/CPP-REBIND-PROPOSAL.html</a></div><div><br><=
/div><div>Implementation files:</div><div><br></div><div><a href=3D"https:/=
/www.google.com/url?q=3Dhttps%3A%2F%2Fgithub.com%2Fcharles-salvia%2Fstd-pro=
posal-generic-template-rebind&amp;sa=3DD&amp;sntz=3D1&amp;usg=3DAFQjCNFd63x=
mUN5MQyW_aWJBKDNIE-w9NA" rel=3D"nofollow" target=3D"_blank" onmousedown=3D"=
this.href=3D&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2=
Fcharles-salvia%2Fstd-proposal-generic-template-rebind\x26sa\x3dD\x26sntz\x=
3d1\x26usg\x3dAFQjCNFd63xmUN5MQyW_aWJBKDNIE-w9NA&#39;;return true;" onclick=
=3D"this.href=3D&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.c=
om%2Fcharles-salvia%2Fstd-proposal-generic-template-rebind\x26sa\x3dD\x26sn=
tz\x3d1\x26usg\x3dAFQjCNFd63xmUN5MQyW_aWJBKDNIE-w9NA&#39;;return true;">htt=
ps://github.com/charles-<wbr>salvia/std-proposal-generic-<wbr>template-rebi=
nd</a></div><div><br></div><div>This is a proposal to create a generic mech=
anism for rebinding template parameters (std::rebind_t), to remove the need=
 for ad-hoc rebind templates, such as std::allocator_traits::rebind_<wbr>al=
loc, etc.=C2=A0</div></div></blockquote><div><br></div><div>This is a bad i=
dea for several philosophical reasons (and I say that as the presenter of <=
a href=3D"https://www.youtube.com/watch?v=3D0MdSJsCTRkY" target=3D"_blank" =
rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;https://www.youtube.com/wa=
tch?v\x3d0MdSJsCTRkY&#39;;return true;" onclick=3D"this.href=3D&#39;https:/=
/www.youtube.com/watch?v\x3d0MdSJsCTRkY&#39;;return true;">this talk</a> on=
 a similar subject. The difference is that I don&#39;t want any &quot;gener=
ic&quot; rebind facility, I just want a greater number of special-purpose r=
ebinders).</div><div><br></div><div>However, your idea doesn&#39;t work any=
way. Try it on some library types:</div><div><br></div><div>=C2=A0 =C2=A0 u=
sing V =3D std::pmr::vector&lt;int&gt;;</div><div>=C2=A0 =C2=A0 using W =3D=
 rebind_t&lt;V, double&gt;;</div><div>=C2=A0 =C2=A0 static_assert(std::is_s=
ame_v&lt;<wbr>W, std::pmr::vector&lt;double&gt;&gt;); =C2=A0// error!</div>=
<div><br></div><div>Since it&#39;s a bad idea <b><i>and</i></b> doesn&#39;t=
 work, I think you should give it up.</div><div><br></div><div>However, it&=
#39;s also much easier to implement as a pure library extension than you th=
ought it was. I can do it in 28 lines and I bet it can be done in fewer.</d=
iv><div><a href=3D"https://wandbox.org/permlink/pRIQ8lJaf8irznwK" target=3D=
"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;https://www.googl=
e.com/url?q\x3dhttps%3A%2F%2Fwandbox.org%2Fpermlink%2FpRIQ8lJaf8irznwK\x26s=
a\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNE7TQ5WnDEbqIXY5r9llFNLTY8laQ&#39;;retur=
n true;" onclick=3D"this.href=3D&#39;https://www.google.com/url?q\x3dhttps%=
3A%2F%2Fwandbox.org%2Fpermlink%2FpRIQ8lJaf8irznwK\x26sa\x3dD\x26sntz\x3d1\x=
26usg\x3dAFQjCNE7TQ5WnDEbqIXY5r9llFNLTY8laQ&#39;;return true;">https://wand=
box.org/permlink/<wbr>pRIQ8lJaf8irznwK</a><br></div><div><br></div><div>=E2=
=80=93Arthur</div></div></blockquote></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/17d39779-2bb9-4073-ab3f-4b14eef2d0de%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/17d39779-2bb9-4073-ab3f-4b14eef2d0de=
%40isocpp.org</a>.<br />

------=_Part_26530_1758866658.1529445456187--

------=_Part_26529_1560161599.1529445456186--

.
