Topic: A Proposal to Relax Constexpr Restrictions for some


Author: Peet <peetnick2@gmail.com>
Date: Fri, 25 Nov 2016 03:32:30 -0800 (PST)
Raw View
------=_Part_10382_263970574.1480073550962
Content-Type: multipart/alternative;
 boundary="----=_Part_10383_97104803.1480073550962"

------=_Part_10383_97104803.1480073550962
Content-Type: text/plain; charset=UTF-8

Hello,

I was basically trying to implement a hash function in C++ using constant
expressions (constexpr).
Sometimes it is necessary to cast a scalar type (or arrays) to cv
unsigned/signed char* to simply get the bytes and do some calculation.
Although it seems that reinterpret_casts aren't allowed in constexpr
(5.20/2.14).
Quickly googling this issue got me to this proposal: "A Proposal to Relax
Constexpr Restrictions for some Reinterpret Casts" by Antony Polukhin [1].
This proposal relaxes the rule for reinterpret_cast in constexpr so that we
can actually cast cv void* to cv unsigned/signed char*.
Although I couldn't find any discussions about this online, also it seems
that the proposal hasn't been sent to the openstd mailing-list.
Does anyone know if this proposal is still "alive" and if this is being
considered proposing?

Regards,
Nick

[1] https://apolukhin.github.io/constexpr_algorithms/reinterpret.html

--
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/afbaf79e-305d-4408-98ab-5b35cfb11f27%40isocpp.org.

------=_Part_10383_97104803.1480073550962
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hello,<div><br></div><div>I was basically trying to implem=
ent a hash function in C++ using constant expressions (constexpr).</div><di=
v>Sometimes it is necessary to cast a scalar type (or arrays) to cv unsigne=
d/signed char* to simply get the bytes and do some calculation.</div><div>A=
lthough it seems that reinterpret_casts aren&#39;t allowed in constexpr (5.=
20/2.14).</div><div>Quickly googling this issue got me to this proposal:=C2=
=A0&quot;A Proposal to Relax Constexpr Restrictions for some Reinterpret Ca=
sts&quot; by=C2=A0Antony Polukhin [1].</div><div>This proposal relaxes the =
rule for reinterpret_cast in constexpr so that we can actually cast cv void=
* to cv unsigned/signed char*.</div><div>Although I couldn&#39;t find any d=
iscussions about this online, also it seems that the proposal hasn&#39;t be=
en sent to the openstd mailing-list.</div><div>Does anyone know if this pro=
posal is still &quot;alive&quot; and if this is being considered proposing?=
</div><div><br></div><div>Regards,</div><div>Nick</div><div><br></div><div>=
[1]=C2=A0https://apolukhin.github.io/constexpr_algorithms/reinterpret.html<=
/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/afbaf79e-305d-4408-98ab-5b35cfb11f27%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/afbaf79e-305d-4408-98ab-5b35cfb11f27=
%40isocpp.org</a>.<br />

------=_Part_10383_97104803.1480073550962--

------=_Part_10382_263970574.1480073550962--

.