uArray
A uC++ macro that allocates a dynamically-sized array on the stack, with deferred per-element construction.
Why?
Standard C++ stack arrays need a compile-time size, and
Obj arr[n]requires a default constructor. When the size is only known at runtime and each element needs different constructor arguments, the only standard option is heap allocation — see Stack vs Heap Allocation.uArrayworks around this while keeping stack semantics (implicit deallocation at scope exit).
{
cin >> size;
uArray( Obj, objs, size ); // macro: stack-allocated, size dynamic
for ( int id = 0; id < size; id += 1 )
objs[id]( id ); // explicit constructor call per element
...
} // implicit array deallocate at block exitEach element is raw storage until you invoke its constructor via objs[id](args). Destructors fire automatically when the block exits.