Add property-like Function to Type ?

Rubn where at is.this
Tue Apr 24 21:36:19 UTC 2018


I was wondering if I could create my own property in a way that 
can be used the same way as something like "T.sizeof". Right now 
I have the following to replace length:

uint length32(T)(T[] array)
{
     return cast(uint)array.length;
}

I want something similar to be able to do the following:


uint size = T.sizeof32;

The closest I can think of is doing:

uint size = sizeof32!T


That's the best I can do, which is fine but I was wondering if 
there's any other way around that?


More information about the Digitalmars-d-learn mailing list