C++ Logo

std-proposals

Advanced search

Re: [std-proposals] std::typeless_memory (type punning)

From: Jonathan Wakely <cxx_at_[hidden]>
Date: Sat, 30 Nov 2024 17:26:42 +0000
On Sat, 30 Nov 2024, 11:47 Artur z Redy via Std-Proposals, <
std-proposals_at_[hidden]> wrote:

> "What usage examples do you have for the typeless_memory ...."
>
> The biggest hole that we can currently have is that You can dynamically
> allocate memory in consteval but You can not use in class buffer memory for
> storing non trivial types. And for trivial types You have to initialize
> such buffer memory even when from owning type view is "unused".
> examples are any custom types with in class buffer memory for example like
> static vectors, partially buffered vectors (to N elems)
> AFIR gnu stdc++ for using std::string in constexpr uses internally out of
> standard accessing non active union member in cosntexpr.
>

Please report a bug if that's still true (I don't think it is).

Received on 2024-11-30 17:28:02