Date: Mon, 22 Jul 2024 16:55:40 +0200
On 7/21/24 18:51, Frederick Virchanza Gotham via Std-Proposals wrote:
> We can use "__datasizeof" or "[[no_unique_address]]" in order to try
> use the tail padding of T to store the boolean, and if we succeed,
> then sizeof(optional<T>) == sizeof(T).
This sounds like an implementation detail.
> If T has no tail padding, then we need an extra byte to store the
> boolean. Unless . . . we had the ability to mark the class
> 'null_bytes==null_object" as follows:
Optionals that leverage unused values / bit-patterns to mark the object
as disengaged has existed for a long time:
https://github.com/akrzemi1/markable
You need, as usual, to provide the motivation for adding this to the
standard.
> We can use "__datasizeof" or "[[no_unique_address]]" in order to try
> use the tail padding of T to store the boolean, and if we succeed,
> then sizeof(optional<T>) == sizeof(T).
This sounds like an implementation detail.
> If T has no tail padding, then we need an extra byte to store the
> boolean. Unless . . . we had the ability to mark the class
> 'null_bytes==null_object" as follows:
Optionals that leverage unused values / bit-patterns to mark the object
as disengaged has existed for a long time:
https://github.com/akrzemi1/markable
You need, as usual, to provide the motivation for adding this to the
standard.
Received on 2024-07-22 14:55:43