Add A1.allocate() template to allocate struct/class instances
This commit is contained in:
parent
40ff805f7d
commit
3e32802862
@ -50,4 +50,15 @@ struct A1
|
||||
|
||||
return cast(void *)address;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocate memory to store an instance of a given type.
|
||||
*
|
||||
* @return Address of allocated memory. This address will always be aligned
|
||||
* to a multiple of 16 bytes.
|
||||
*/
|
||||
public static T * allocate(T)()
|
||||
{
|
||||
return cast(T *)allocate(T.sizeof);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user