On Tuesday, 7 June 2016 at 04:31:56 UTC, ParticlePeter wrote:
On Monday, 6 June 2016 at 20:32:23 UTC, Alex Parrill wrote:
They'd be the same type, since you would define the vulkan
functions to take these structures instead of pointer or
integer types.
It relies on a lot of assumptions about the ABI that make a
raw pointer work the same as a structure containing just one
pointer, which is why I did not give it much consideration.
Is there a way to use opCast (just an idea, not working code) ?
private struct VK_HANDLE_HELPER {
const void * handle = null;
alias handle this;
T opCast(T)() if( is( T == uint64_t )) {
return 0uL;
}
}
const VK_NULL_HANDLE = VK_HANDLE_HELPER();
I don't think opCast gets called for implicit conversions; it
only gets called for explicit casts. I'll test it later.