dmd/changelog/dmd.placementNew.dd
2025-03-03 16:23:02 +10:00

20 lines
340 B
Text

# Added Placement New Expression
Placement new explicitly provides the storage for NewExpression to initialize
with the newly created value, rather than using the GC.
---
struct S
{
float d;
int i;
char c;
}
void main()
{
S s;
S* p = new (s) S(); // place new object into s
assert(p.i == 0 && p.c == 0xFF);
}
---