new
, as well as, destroy the object through delete
new
, as well as, destroy the array through delete []
unsafe
(i.e. use them in unsafe context/block)Create a single object like the way in C++ ````rust let ptr = new!{ i32 }; // with default initialization let ptr_init = new!{ i32 {10} }; // with 10 as its initializer
// destroy the created objects
delete!{ ptr };
delete!{ ptr_init };
````
Create an array object ````rust let size = 2; let arr = new!{ i32[size] }; let arr_init = new!{ i32[size]{0,1}};
let muldimarr = new!{ i32[size][3][4] }; let twodimarr = new!{ i32[size][3] {[0,0,0], [1,2,3]} };
// destroy the created objects delete!{ [] arr}; delete!{ [] arrinit}; delete!{ [] muldimarr}; delete!{ [] twodim_arr}; ````