Skip to content

Conversation

@Halalaluyafail3
Copy link

It is not valid to use reinterpret_cast in a constant expression, and even outside of constant expressions the use is UB as described in #54. Instead of using a byte array, a union which contains an array can be used for the same purpose. This makes the name of the class wrong, but I have left it unchanged for now.

@wusatosi
Copy link
Member

wusatosi commented Jun 7, 2025

Hi @Halalaluyafail3 , this implement is based on the original inplace vector paper (P0843) without implementing trivial unions (P3074) (as currently there's no compiler support).

In P0843, inplace vector is only required to be constexpr for trivial element type T.

This is designed that for non trivial types, the default constructor is not called unnecessarily and allows default constructor deleted element type.

You can read more about this here: The storage problem.

@Halalaluyafail3
Copy link
Author

Ok, if that is intended it seems misleading to use constexpr in the definitions of storage_data.

@wusatosi
Copy link
Member

wusatosi commented Jun 8, 2025

Ok, if that is intended it seems misleading to use constexpr in the definitions of storage_data.

good point, it shouldn't be.

@JeffGarland
Copy link
Member

So it seems like we aren't going to merge this, but maybe the cast should have a big juicy comment on it that explains why it's there for now?

@wusatosi
Copy link
Member

See #102 .

@wusatosi wusatosi closed this Sep 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants