O
Ole Nielsby
I want to create a class with a variably-sized array inlined.
The array size will be known at each instantiation but not
at compile time. Once created, arrays won't grow or shrink
and their contents won't change.
The array length will be accessible via a smart pointer
located before the array. On destruction, it must be fetched
before the smartpointer containing it is destroyed.
The arrays will typically hold smart pointers, so proper
destruction is a must.
Is this feasible with C++?
Unfortunately, overloading new() won't do the trick unless
I resort to nasties such as passing the required extra byte
count in a TLS slot.
The array size will be known at each instantiation but not
at compile time. Once created, arrays won't grow or shrink
and their contents won't change.
The array length will be accessible via a smart pointer
located before the array. On destruction, it must be fetched
before the smartpointer containing it is destroyed.
The arrays will typically hold smart pointers, so proper
destruction is a must.
Is this feasible with C++?
Unfortunately, overloading new() won't do the trick unless
I resort to nasties such as passing the required extra byte
count in a TLS slot.