220 29566 <14dc989b-7a2f-478b-b16e-b9297fb1782f@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Edward Catmur <ed@catmur.co.uk>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: "A Proposal to Relax Constexpr Restrictions for
 some Reinterpret Casts" ?
Date: Mon, 28 Nov 2016 14:35:37 -0800 (PST)
Lines: 99
Approved: news@gmane.org
Message-ID: <14dc989b-7a2f-478b-b16e-b9297fb1782f@isocpp.org>
References: <afbaf79e-305d-4408-98ab-5b35cfb11f27@isocpp.org> <CALnjya_VWQUMYGGd9tYy_cJWiwvsyUF2joMuCMPsPy=T6e15XA@mail.gmail.com>
 <CAJwqTS9XiyDK+7wWCRTCTjcnFnKQk6WudsrRTidgf4Ygoc0yng@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_11810_967191564.1480372537100"
X-Trace: blaine.gmane.org 1480372543 4056 195.159.176.226 (28 Nov 2016 22:35:43 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Mon, 28 Nov 2016 22:35:43 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBDZLZTXF7UJBBOPC6LAQKGQE4RGZRXY@isocpp.org Mon Nov 28 23:35:39 2016
Return-path: <std-proposals+bncBDZLZTXF7UJBBOPC6LAQKGQE4RGZRXY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-pf0-f197.google.com ([209.85.192.197])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDZLZTXF7UJBBOPC6LAQKGQE4RGZRXY@isocpp.org>)
	id 1cBUWN-00088I-Gn
	for gclcip-std-proposals@m.gmane.org; Mon, 28 Nov 2016 23:35:35 +0100
Original-Received: by mail-pf0-f197.google.com with SMTP id 83sf233583440pfx.1
        for <gclcip-std-proposals@m.gmane.org>; Mon, 28 Nov 2016 14:35:39 -0800 (PST)
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
         :x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=QuU/fiCnJX8zCI5D1zJgwHtxJx6mRlxbGByL+pZWeyQ=;
        b=R9YVizoNDvtUdJKnJfZfNzKQkB7wKv2AWACGP8KZZp8OONELPBTqCJnP8aIMIVc71L
         r0VHYjBQjqjdZtGB/cTqK9Peu9Si+Dog90ly/KWA/NVSRl/NtrKb/agDw/fRCkLQqqBV
         IgTj1/uF7DMroJkEAnIfRRGBdiLpzNn9pLuSlnveFhXgmUfryopCplnB+iIajJQntocZ
         osu3/UL/wun26gw17lht6eaFNMoMcNf1hXSb9vp6UM4qKDoez3Rxo7iZavgT5Vsp1K2A
         pjgh0y73GSV32Q9E006XEJs0QxEnbcqj4Y8MWF8uyhHkzZhK/XxHGhswSmD/EZzwIxih
         Nrug==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        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=QuU/fiCnJX8zCI5D1zJgwHtxJx6mRlxbGByL+pZWeyQ=;
        b=RVf81oyyreZQCVH5EhXpqkME/xLN1t2+iM+c6U2MMgK8BvICAz0m3m5M9w/HGH/ZnZ
         fxCdjb/9F7Rirp0zt82C3dZ3ElkgBrG0aF9i+xnePVS346Xp8XfigJC++mfx0VP2Zn3g
         OrE+ZOcMKyPXS7r12Wn+Cbq73ZQrgF4Vxm6Ic58GP4DWsu7qeOydbevrwiI1Kq9Y6Xz9
         Ek8gcHByBKzshuDdpeutUSJnPWMux9kFKFOUzD4VIb84Dhs2DxcufbX6GE+6nD2f4br9
         ocyaTEtdr1NIY7Ocw9ZmBoxzZ7VgGSkf/BEmU80fxA411vteUdH4RFxBTt9DG3v5IlPj
         pcTQ==
X-Gm-Message-State: AKaTC03GQMMVCarxLQskn5ksv5hbgWOmxtQxY9V/Iv6VdJpMEd5LavKjKdrG9tTdA6ec2Q==
X-Received: by 10.98.82.208 with SMTP id g199mr4015141pfb.7.1480372538756;
        Mon, 28 Nov 2016 14:35:38 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.157.21.102 with SMTP id z35ls1347664otz.38.gmail; Mon, 28 Nov
 2016 14:35:37 -0800 (PST)
X-Received: by 10.157.37.125 with SMTP id j58mr739346otd.18.1480372537510;
        Mon, 28 Nov 2016 14:35:37 -0800 (PST)
In-Reply-To: <CAJwqTS9XiyDK+7wWCRTCTjcnFnKQk6WudsrRTidgf4Ygoc0yng@mail.gmail.com>
X-Original-Sender: ed@catmur.co.uk
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:29566
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/29566>

------=_Part_11810_967191564.1480372537100
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On Monday, 28 November 2016 22:04:42 UTC, Peet Nick  wrote:
> I am not sure how that would help? The destination type must have the sam=
e size as the source type, how would that help me getting the "raw byte vie=
w" of an scalar/pod?

You would bit_cast to an array (or std::array) of unsigned char of the same=
 size as your pod.=20

> On Fri, Nov 25, 2016 at 4:32 PM, Mathias Gaunard <mat...@gaunard.com> wro=
te:
>=20
> I think you would have better luck with the new function bit_cast which m=
ight end up being constexpr.
>=20
>=20
>=20
>=20
> On 25 November 2016 at 11:32, Peet <peet...@gmail.com> wrote:
>=20
> Hello,
>=20
>=20
> 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 unsigne=
d/signed char* to simply get the bytes and do some calculation.
> Although it seems that reinterpret_casts aren't allowed in constexpr (5.2=
0/2.14).
> Quickly googling this issue got me to this proposal:=C2=A0"A Proposal to =
Relax Constexpr Restrictions for some Reinterpret Casts" by=C2=A0Antony Pol=
ukhin [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 c=
onsidered proposing?
>=20
>=20
> Regards,
> Nick
>=20
>=20
> [1]=C2=A0https://apolukhin.github.io/constexpr_algorithms/reinterpret.htm=
l
>=20
>=20
>=20
>=20
> --=20
>=20
> You received this message because you are subscribed to the Google Groups=
 "ISO C++ Standard - Future Proposals" group.
>=20
> To unsubscribe from this group and stop receiving emails from it, send an=
 email to std-proposal...@isocpp.org.
>=20
> To post to this group, send email to std-pr...@isocpp.org.
>=20
> To view this discussion on the web visit https://groups.google.com/a/isoc=
pp.org/d/msgid/std-proposals/afbaf79e-305d-4408-98ab-5b35cfb11f27%40isocpp.=
org.
>=20
>=20
>=20
>=20
>=20
>=20
>=20
> --=20
>=20
> You received this message because you are subscribed to the Google Groups=
 "ISO C++ Standard - Future Proposals" group.
>=20
> To unsubscribe from this group and stop receiving emails from it, send an=
 email to std-proposal...@isocpp.org.
>=20
> To post to this group, send email to std-pr...@isocpp.org.
>=20
> To view this discussion on the web visit https://groups.google.com/a/isoc=
pp.org/d/msgid/std-proposals/CALnjya_VWQUMYGGd9tYy_cJWiwvsyUF2joMuCMPsPy%3D=
T6e15XA%40mail.gmail.com.

--=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/14dc989b-7a2f-478b-b16e-b9297fb1782f%40isocpp.or=
g.

------=_Part_11810_967191564.1480372537100--

.
