Topic: Is it necessary to add a stronger keyword


Author: Henry Miller <hank@millerfarm.com>
Date: Thu, 09 Aug 2018 14:43:10 -0500
Raw View
This is a multi-part message in MIME format.

--_----------=_153384379040371502
Content-Type: text/plain; charset="UTF-8"




On Thu, Aug 9, 2018, at 12:11 PM, Greg Marr wrote:
> On Tuesday, August 7, 2018 at 8:23:36 PM UTC-4, Vishal Oza wrote:
>> I think I would like to have a different behavior then const. I would
>> like the keyword to set the variable as a constant during the
>> lifetime of the object like readonly.>
> How is that different than const?
>

You can't do const_cast to make it non const?

I personally have only seen a handful of const_cast uses in my
lifetime, and it it has mislead me into looking elsewhere for a bug
thinking that something would not change when it did. Of course
afterwards you get the duh moment, but it is surprising when in
practice something const changes.
I also understand that the possibility of const_cast prevents some
compiler optimizations. If the optimizer implementors could get anything
out of this that is a point in favor.
Otherwise I don't see the point. Doesn't mean that it is a bad idea, but
I don't see it

--
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/1533843790.4037150.1469118456.61869668%40webmail.messagingengine.com.

--_----------=_153384379040371502
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset="UTF-8"

<!DOCTYPE html>
<html>
<head>
<title></title>
<style type=3D"text/css">p.MsoNormal,p.MsoNoSpacing{margin:0}</style>
</head>
<body><div style=3D"font-family:Arial;"><br></div>
<div><br></div>
<div><br></div>
<div>On Thu, Aug 9, 2018, at 12:11 PM, Greg Marr wrote:<br></div>
<blockquote type=3D"cite"><div dir=3D"ltr"><div style=3D"font-family:Arial;=
">On Tuesday, August 7, 2018 at 8:23:36 PM UTC-4, Vishal Oza wrote:<br></di=
v>
<blockquote defang_data-gmailquote=3D"yes" style=3D"margin-top:0px;margin-r=
ight:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-l=
eft-style:solid;border-left-color:rgb(204, 204, 204);padding-left:1ex;"><di=
v dir=3D"ltr">I think I would like to have a different behavior&nbsp;then c=
onst. I would like the keyword to set the variable as a constant during the=
 lifetime of the object like readonly.<br></div>
</blockquote><div><br></div>
<div>How is that different than const?<br></div>
<div><br></div>
</div>
</blockquote><div style=3D"font-family:Arial;"><br></div>
<div style=3D"font-family:Arial;">You can't do const_cast to make it non co=
nst?&nbsp;<br></div>
<div style=3D"font-family:Arial;"><br></div>
<div style=3D"font-family:Arial;">I personally have only seen a handful of =
const_cast uses in my lifetime, and it it has mislead me into looking elsew=
here for a bug thinking that something would not change when it did. Of cou=
rse afterwards you get the duh moment, but it is surprising when in practic=
e something const changes.&nbsp;<br></div>
<div style=3D"font-family:Arial;"><br></div>
<div style=3D"font-family:Arial;">I also understand that the possibility of=
 const_cast prevents some compiler optimizations. If the optimizer implemen=
tors could get anything out of this that is a point in favor.&nbsp;<br></di=
v>
<div style=3D"font-family:Arial;"><br></div>
<div style=3D"font-family:Arial;">Otherwise I don't see the point. Doesn't =
mean that it is a bad idea, but I don't see it&nbsp;</div>
</body>
</html>

<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/1533843790.4037150.1469118456.6186966=
8%40webmail.messagingengine.com?utm_medium=3Demail&utm_source=3Dfooter">htt=
ps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/1533843790.403715=
0.1469118456.61869668%40webmail.messagingengine.com</a>.<br />

--_----------=_153384379040371502--


.


Author: "'Matt Calabrese' via ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Date: Thu, 9 Aug 2018 16:04:22 -0400
Raw View
--000000000000defea80573062254
Content-Type: text/plain; charset="UTF-8"

On Thu, Aug 9, 2018 at 3:43 PM Henry Miller <hank@millerfarm.com> wrote:

>
>
>
> On Thu, Aug 9, 2018, at 12:11 PM, Greg Marr wrote:
>
> On Tuesday, August 7, 2018 at 8:23:36 PM UTC-4, Vishal Oza wrote:
>
> I think I would like to have a different behavior then const. I would like
> the keyword to set the variable as a constant during the lifetime of the
> object like readonly.
>
>
> How is that different than const?
>
>
> You can't do const_cast to make it non const?
>

Already with current C++ if you have an object that was originally declared
const and then you use const_cast to get a non-const reference to the
object, modifying the object through it is UB.

--
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/CANh8DEnLCZ%2BmkOXOEfLCObtEjctmWocF%2Bbvvr5RHEY5r7KuNeg%40mail.gmail.com.

--000000000000defea80573062254
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_quote"><div dir=3D"ltr">On Thu, Aug 9,=
 2018 at 3:43 PM Henry Miller &lt;<a href=3D"mailto:hank@millerfarm.com">ha=
nk@millerfarm.com</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote"=
 style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u=
></u>





<div><div style=3D"font-family:Arial"><br></div>
<div><br></div>
<div><br></div>
<div>On Thu, Aug 9, 2018, at 12:11 PM, Greg Marr wrote:<br></div>
<blockquote type=3D"cite"><div dir=3D"ltr"><div style=3D"font-family:Arial"=
>On Tuesday, August 7, 2018 at 8:23:36 PM UTC-4, Vishal Oza wrote:<br></div=
>
<blockquote style=3D"margin-top:0px;margin-right:0px;margin-bottom:0px;marg=
in-left:0.8ex;border-left-width:1px;border-left-style:solid;border-left-col=
or:rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr">I think I would like=
 to have a different behavior=C2=A0then const. I would like the keyword to =
set the variable as a constant during the lifetime of the object like reado=
nly.<br></div>
</blockquote><div><br></div>
<div>How is that different than const?<br></div>
<div><br></div>
</div>
</blockquote><div style=3D"font-family:Arial"><br></div>
<div style=3D"font-family:Arial">You can&#39;t do const_cast to make it non=
 const?=C2=A0<br></div></div></blockquote><div><br></div><div>Already with =
current C++ if you have an object that was originally declared const and th=
en you use const_cast to get a non-const reference to the object, modifying=
 the object through it is UB.</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/CANh8DEnLCZ%2BmkOXOEfLCObtEjctmWocF%2=
Bbvvr5RHEY5r7KuNeg%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter"=
>https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CANh8DEnLCZ%2=
BmkOXOEfLCObtEjctmWocF%2Bbvvr5RHEY5r7KuNeg%40mail.gmail.com</a>.<br />

--000000000000defea80573062254--

.


Author: florian.csdt@gmail.com
Date: Thu, 9 Aug 2018 13:16:38 -0700 (PDT)
Raw View
------=_Part_538_102531841.1533845798737
Content-Type: multipart/alternative;
 boundary="----=_Part_539_1984295807.1533845798738"

------=_Part_539_1984295807.1533845798738
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable



Le jeudi 9 ao=C3=BBt 2018 22:04:37 UTC+2, Matt Calabrese a =C3=A9crit :
>
> On Thu, Aug 9, 2018 at 3:43 PM Henry Miller <ha...@millerfarm.com=20
> <javascript:>> wrote:
>
>>
>>
>>
>> On Thu, Aug 9, 2018, at 12:11 PM, Greg Marr wrote:
>>
>> On Tuesday, August 7, 2018 at 8:23:36 PM UTC-4, Vishal Oza wrote:
>>
>> I think I would like to have a different behavior then const. I would=20
>> like the keyword to set the variable as a constant during the lifetime o=
f=20
>> the object like readonly.
>>
>>
>> How is that different than const?
>>
>>
>> You can't do const_cast to make it non const?=20
>>
>
> Already with current C++ if you have an object that was originally=20
> declared const and then you use const_cast to get a non-const reference t=
o=20
> the object, modifying the object through it is UB.
>

In a multithreaded environment, it is also possible for a const reference=
=20
to be modified, but that's also UB if no synchronization primitive is used=
=20
(like atomics or locks).

--=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/ce85b5ba-1514-470a-aa8e-dbfa0a528cb8%40isocpp.or=
g.

------=_Part_539_1984295807.1533845798738
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>Le jeudi 9 ao=C3=BBt 2018 22:04:37 UTC+2, Matt Cal=
abrese a =C3=A9crit=C2=A0:<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 class=3D"gmail_quote"><div dir=3D"ltr">On Thu, Aug 9, 201=
8 at 3:43 PM Henry Miller &lt;<a href=3D"javascript:" target=3D"_blank" gdf=
-obfuscated-mailto=3D"A6hE1CAHDQAJ" rel=3D"nofollow" onmousedown=3D"this.hr=
ef=3D&#39;javascript:&#39;;return true;" onclick=3D"this.href=3D&#39;javasc=
ript:&#39;;return true;">ha...@millerfarm.com</a>&gt; wrote:<br></div><bloc=
kquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #cc=
c solid;padding-left:1ex"><u></u>





<div><div style=3D"font-family:Arial"><br></div>
<div><br></div>
<div><br></div>
<div>On Thu, Aug 9, 2018, at 12:11 PM, Greg Marr wrote:<br></div>
<blockquote type=3D"cite"><div dir=3D"ltr"><div style=3D"font-family:Arial"=
>On Tuesday, August 7, 2018 at 8:23:36 PM UTC-4, Vishal Oza wrote:<br></div=
>
<blockquote style=3D"margin-top:0px;margin-right:0px;margin-bottom:0px;marg=
in-left:0.8ex;border-left-width:1px;border-left-style:solid;border-left-col=
or:rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr">I think I would like=
 to have a different behavior=C2=A0then const. I would like the keyword to =
set the variable as a constant during the lifetime of the object like reado=
nly.<br></div>
</blockquote><div><br></div>
<div>How is that different than const?<br></div>
<div><br></div>
</div>
</blockquote><div style=3D"font-family:Arial"><br></div>
<div style=3D"font-family:Arial">You can&#39;t do const_cast to make it non=
 const?=C2=A0<br></div></div></blockquote><div><br></div><div>Already with =
current C++ if you have an object that was originally declared const and th=
en you use const_cast to get a non-const reference to the object, modifying=
 the object through it is UB.</div></div></div></blockquote><div><br></div>=
<div>In a multithreaded environment, it is also possible for a const refere=
nce to be modified, but that&#39;s also UB if no synchronization primitive =
is used (like atomics or locks).<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/ce85b5ba-1514-470a-aa8e-dbfa0a528cb8%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/ce85b5ba-1514-470a-aa8e-dbfa0a528cb8=
%40isocpp.org</a>.<br />

------=_Part_539_1984295807.1533845798738--

------=_Part_538_102531841.1533845798737--

.


Author: Thiago Macieira <thiago@macieira.org>
Date: Thu, 09 Aug 2018 15:16:30 -0700
Raw View
On Thursday, 9 August 2018 13:04:22 PDT 'Matt Calabrese' via ISO C++ Standard
- Future Proposals wrote:
> Already with current C++ if you have an object that was originally declared
> const and then you use const_cast to get a non-const reference to the
> object, modifying the object through it is UB.

True, but if the variable was declared elsewhere (obtained via pointer or
reference), then the compiler doesn't know if it's really const. It has to
assume that the called function may const_cast and therefore it has to reload
values.

--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center



--
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/16321877.BVm0bQjrI1%40tjmaciei-mobl1.

.


Author: "zhouhongyu1104@gmail.com" <zhouhongyu1104@gmail.com>
Date: Sat, 11 Aug 2018 03:18:49 +0800
Raw View
This is a multi-part message in MIME format.

------=_001_NextPart064122788464_=----
Content-Type: text/plain; charset="UTF-8"

On Friday, August 10, 2018 at 2:19:49 PM UTC-4, zhouhon...@gmail.com wrote:
>
> Thank you for your reply. Someone mentioned virtual static, this is
> exactly what I want to express. I want to use inheritable static methods in
> polymorphism.
>

What would that mean? How would it be any different from a `virtual`,
non-static method? Do you just want to prevent yourself from accessing
members through `this`?

--
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/201808110318476054020%40gmail.com.

------=_001_NextPart064122788464_=----
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<html><head></head><body><div class=3D"">yes :)</div><div>&nbsp;</div><hr s=
tyle=3D"WIDTH: 210px; HEIGHT: 1px" color=3D"#b5c4df" size=3D"1" align=3D"le=
ft"><div><span><div style=3D"MARGIN: 10px; FONT-FAMILY: verdana; FONT-SIZE:=
 10pt"><div>zhouhongyu1104@gmail.com</div></div></span></div><blockquote st=
yle=3D"margin-Top: 0px; margin-Bottom: 0px; margin-Left: 0.5em"><div>&nbsp;=
</div><div style=3D"border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0p=
t 0cm 0cm 0cm"><div style=3D"PADDING-RIGHT: 8px; PADDING-LEFT: 8px; FONT-SI=
ZE: 12px;FONT-FAMILY:tahoma;COLOR:#000000; BACKGROUND: #efefef; PADDING-BOT=
TOM: 8px; PADDING-TOP: 8px"><div><b>From:</b>&nbsp;<a href=3D"mailto:jmckes=
son@gmail.com">Nicol Bolas</a></div><div><b>Date:</b>&nbsp;2018-08-11&nbsp;=
03:17</div><div><b>To:</b>&nbsp;<a href=3D"mailto:std-proposals@isocpp.org"=
>ISO C++ Standard - Future Proposals</a></div><div><b>CC:</b>&nbsp;<a href=
=3D"mailto:zhouhongyu1104@gmail.com">zhouhongyu1104</a></div><div><b>Subjec=
t:</b>&nbsp;Re: Is it necessary to add a stronger keyword than `const`?</di=
v></div></div><div><div class=3D""><style>div.FoxDIV_20180811031721938 { fo=
nt-size: 10.5pt }
</style><div style=3D"height:initial" class=3D"FoxDIV_20180811031721938"><d=
iv dir=3D"ltr">On Friday, August 10, 2018 at 2:19:49 PM UTC-4, zhouhon...@g=
mail.com wrote:
<div 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"lt=
r">Thank you for your reply. Someone mentioned virtual static, this is exac=
tly what I want to express. I want to use inheritable static methods in pol=
ymorphism.<br></div></blockquote></div>
<div><br></div><div>What would that mean? How would it be any different fro=
m a `virtual`, non-static method? Do you just want to prevent yourself from=
 accessing members through `this`?<br></div></div></div></div></div></block=
quote></body></html>

<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/201808110318476054020%40gmail.com?utm=
_medium=3Demail&utm_source=3Dfooter">https://groups.google.com/a/isocpp.org=
/d/msgid/std-proposals/201808110318476054020%40gmail.com</a>.<br />

------=_001_NextPart064122788464_=------


.


Author: Jake Arkinstall <jake.arkinstall@gmail.com>
Date: Sat, 11 Aug 2018 12:00:03 +0100
Raw View
--00000000000080f607057326c38f
Content-Type: text/plain; charset="UTF-8"

So this is just static virtual inheritance in all but name.

It depends on what you need it for. If you just want to declare an
interface that a class has to abide by, use templates and the CRTP. That
way a class X wont compile if it inherits from parent<X> and doesnt
implement the static methods of X  that the parent uses. If you want to
avoid the parent class you can SFINAE your way out of this - passing the
class name as a template parameter to any method that needs it, instead of
as an argument.

I don't know if concepts cover static methods, but they'd make that whole
process a lot simpler.

If you have a specific reason to cast to a generic parent type (e.g.
storing a bunch of different child classes in a container, via pointers to
the parent class type), the template approach won't help. I guess a
"pseudostatic" keyword for this purpose - i.e. a method with the rules of
static, that can be accessed as static, but can also be accessed via *this*
- would change that, but that's expensive and I honestly haven't seen any
legitimate (i.e. beyond toy examples) need for that functionality in modern
C++.

On Fri, 10 Aug 2018, 20:18 zhouhongyu1104@gmail.com, <
zhouhongyu1104@gmail.com> wrote:

> yes :)
>
> ------------------------------
> zhouhongyu1104@gmail.com
>
>
> *From:* Nicol Bolas <jmckesson@gmail.com>
> *Date:* 2018-08-11 03:17
> *To:* ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
> *CC:* zhouhongyu1104 <zhouhongyu1104@gmail.com>
> *Subject:* Re: Is it necessary to add a stronger keyword than `const`?
> On Friday, August 10, 2018 at 2:19:49 PM UTC-4, zhouhon...@gmail.com
> wrote:
>
>> Thank you for your reply. Someone mentioned virtual static, this is
>> exactly what I want to express. I want to use inheritable static methods in
>> polymorphism.
>>
>
> What would that mean? How would it be any different from a `virtual`,
> non-static method? Do you just want to prevent yourself from accessing
> members through `this`?
>
> --
> 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/201808110318476054020%40gmail.com
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/201808110318476054020%40gmail.com?utm_medium=email&utm_source=footer>
> .
>

--
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/CAC%2B0CCN5jgE%2BOxoGcWmXqYO7G2Kke5Hro%3DZy%2BWZUNAe1B4NLmw%40mail.gmail.com.

--00000000000080f607057326c38f
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"auto"><div dir=3D"auto">So this is just static virtual inherita=
nce in all but name.</div><div dir=3D"auto"><br></div><div dir=3D"auto">It =
depends on what you need it for. If you just want to declare an interface t=
hat a class has to abide by, use templates and the CRTP. That way a class X=
 wont compile if it inherits from parent&lt;X&gt; and doesnt implement the =
static methods of X=C2=A0 that the parent uses. If you want to avoid the pa=
rent class you can SFINAE your way out of this - passing the class name as =
a template parameter to any method that needs it, instead of as an argument=
..</div><div dir=3D"auto"><span style=3D"font-family:sans-serif"><br></span>=
</div><div dir=3D"auto">I<span style=3D"font-family:sans-serif"> don&#39;t =
know if concepts cover static methods, but they&#39;d make that whole proce=
ss a lot simpler.</span></div><div dir=3D"auto"><div dir=3D"auto" style=3D"=
font-family:sans-serif"><br></div><div dir=3D"auto" style=3D"font-family:sa=
ns-serif">If you have a specific reason to cast to a generic parent type (e=
..g. storing a bunch of different child classes in a container, via pointers=
 to the parent class type), the template approach won&#39;t help. I guess a=
 &quot;pseudostatic&quot; keyword for this purpose - i.e. a method with the=
 rules of static, that can be accessed as static, but can also be accessed =
via <i>this</i> - would change that, but that&#39;s expensive and I honestl=
y haven&#39;t seen any legitimate (i.e. beyond toy examples) need for that =
functionality in modern C++.</div></div></div><br><div class=3D"gmail_quote=
"><div dir=3D"ltr">On Fri, 10 Aug 2018, 20:18 <a href=3D"mailto:zhouhongyu1=
104@gmail.com">zhouhongyu1104@gmail.com</a>, &lt;<a href=3D"mailto:zhouhong=
yu1104@gmail.com">zhouhongyu1104@gmail.com</a>&gt; wrote:<br></div><blockqu=
ote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc s=
olid;padding-left:1ex"><div><div>yes :)</div><div>=C2=A0</div><hr style=3D"=
WIDTH:210px;HEIGHT:1px" color=3D"#b5c4df" size=3D"1" align=3D"left"><div><s=
pan><div style=3D"MARGIN:10px;FONT-FAMILY:verdana;FONT-SIZE:10pt"><div><a h=
ref=3D"mailto:zhouhongyu1104@gmail.com" target=3D"_blank" rel=3D"noreferrer=
">zhouhongyu1104@gmail.com</a></div></div></span></div><blockquote style=3D=
"margin-Top:0px;margin-Bottom:0px;margin-Left:0.5em"><div>=C2=A0</div><div =
style=3D"border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0cm 0cm 0=
cm"><div style=3D"PADDING-RIGHT:8px;PADDING-LEFT:8px;FONT-SIZE:12px;FONT-FA=
MILY:tahoma;COLOR:#000000;BACKGROUND:#efefef;PADDING-BOTTOM:8px;PADDING-TOP=
:8px"><div><b>From:</b>=C2=A0<a href=3D"mailto:jmckesson@gmail.com" target=
=3D"_blank" rel=3D"noreferrer">Nicol Bolas</a></div><div><b>Date:</b>=C2=A0=
2018-08-11=C2=A003:17</div><div><b>To:</b>=C2=A0<a href=3D"mailto:std-propo=
sals@isocpp.org" target=3D"_blank" rel=3D"noreferrer">ISO C++ Standard - Fu=
ture Proposals</a></div><div><b>CC:</b>=C2=A0<a href=3D"mailto:zhouhongyu11=
04@gmail.com" target=3D"_blank" rel=3D"noreferrer">zhouhongyu1104</a></div>=
<div><b>Subject:</b>=C2=A0Re: Is it necessary to add a stronger keyword tha=
n `const`?</div></div></div><div><div><div style=3D"height:initial" class=
=3D"m_-3458072061566013981FoxDIV_20180811031721938"><div dir=3D"ltr">On Fri=
day, August 10, 2018 at 2:19:49 PM UTC-4, <a href=3D"mailto:zhouhon...@gmai=
l.com" target=3D"_blank" rel=3D"noreferrer">zhouhon...@gmail.com</a> 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">Thank you for=
 your reply. Someone mentioned virtual static, this is exactly what I want =
to express. I want to use inheritable static methods in polymorphism.<br></=
div></blockquote></div>
<div><br></div><div>What would that mean? How would it be any different fro=
m a `virtual`, non-static method? Do you just want to prevent yourself from=
 accessing members through `this`?<br></div></div></div></div></div></block=
quote></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" target=3D"_=
blank" rel=3D"noreferrer">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank" rel=3D"noreferrer">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/201808110318476054020%40gmail.com?utm=
_medium=3Demail&amp;utm_source=3Dfooter" target=3D"_blank" rel=3D"noreferre=
r">https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/20180811031=
8476054020%40gmail.com</a>.<br>
</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/CAC%2B0CCN5jgE%2BOxoGcWmXqYO7G2Kke5Hr=
o%3DZy%2BWZUNAe1B4NLmw%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfoo=
ter">https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAC%2B0CC=
N5jgE%2BOxoGcWmXqYO7G2Kke5Hro%3DZy%2BWZUNAe1B4NLmw%40mail.gmail.com</a>.<br=
 />

--00000000000080f607057326c38f--

.