Trying this
import std.bitmanip;
import std.typecons;
void main(){}
struct S1
{
mixin(taggedPointer!(
Val*, "vv",
bool, "b1", 1,
bool, "b2", 1,
bool, "b3", 1));
}
struct S2
{
mixin(taggedPointer!(
Val*, "vv",
ubyte, "t", 3));
}
struct S3
{
mixin(taggedPointer!(
Val*, "vv",
Ternary, "t", 3));
}
struct Val
{
size_t dummy;
}
I got an error:
bitmanip.d(94,20): Error: no property 'min' for type 'Ternary'
bitmanip.d(127,20): Error: no property 'min' for type 'Ternary'
bitmanip.d(183,15): Error: template instance std.bitmanip.createAccessors!("_vv_t", Ternary, "t", 3LU, 0LU) error instantiating
bitmanip.d(243,11): instantiated from here: createFields!("_vv_t", 0LU, Ternary, "t", 3, ulong, "", 61LU)
bitmanip.d(314,26): instantiated from here: createTaggedReference!(Val*, 8LU, "vv", Ternary, "t", 3)
test62.d(17,8): instantiated from here: taggedPointer!(Val*, "vv", Ternary, "t", 3)
I understand, that it is not possible to order a Ternary without implifications. However, as the size allows it, it should be possible to use it as a pointer discriminator.
Comment #1 by robert.schadek — 2024-12-01T16:30:10Z