Description
- Support to create a single object through
new
, as well as, destroy the object throughdelete
- Support to create an array object through
new
, as well as, destroy the array throughdelete []
- Support multiple dimension array with the syntax of C++
- For an array object, if the initializer expressions are less than the size of the created array, the remaining elements are default initialized
- Notice that all functions/macros in this library are
unsafe
(i.e. use them in unsafe context/block)
How to use this library
Create a single object like the way in C++
let ptr = new!; // with default initialization
let ptr_init = new!; // with 10 as its initializer
// destroy the created objects
delete!;
delete!;
Create an array object
let size = 2;
let arr = new!;
let arr_init = new!;
let mul_dim_arr = new!;
let two_dim_arr = new!;
// destroy the created objects
delete!;
delete!;
delete!;
delete!;