I'm not as familiar with how C++ does allocations compared to julia, but I'd imagine the limitations would be similar - if `new` can allocate memory on the stack, I can't imagine why it wouldn't work out of the box.
C++ really isn't my forte though.
C++ really isn't my forte though.
You can also overload it, so that it can be given as implicit parameter.
Modern C++ compilers are also able to do escape analysis and remove new altogether,
https://godbolt.org/z/f9vnxG88K
If you try AVR instead of X64, the optimization will be missing, which is only a side effect of the backend not having as much attention in what it looks into.
What guarantees can you assure about the state of the application?
In any case, in this specific example for x64 it doesn't matter, because new gets optimized away.
However, if that optimization isn't done, e.g. AVR backend, then nasal daemons will be summoned.