I am writing a memory management template class in which I want to create a C-style fixed-size array to serve as a heap. I save the objects in an array as follows:
T v[SIZE];
Since this only serves as a heap role that can hold T objects, I don’t want the default constructor T to be automatically called for every object in the array.
I thought of a decision to define a bunch like this:
char v[SIZE * sizeof(T)];
... but it will give me alignment problems.
Is there a better way to achieve this?
ADD: Since I have specific runtime requirements, it is important that this class does not make any allocations on the global heap.
ADD 2: SIZE is a template argument and is known at compile time.