26template <
typename T,
unsigned N = 8>
class SimpleVLA final {
28 T *HeapBuffer =
nullptr;
33 SimpleVLA(
const SimpleVLA &) =
delete;
34 SimpleVLA(SimpleVLA &&) =
delete;
35 SimpleVLA &operator=(
const SimpleVLA &) =
delete;
36 SimpleVLA &operator=(SimpleVLA &&) =
delete;
38 explicit SimpleVLA(
unsigned NumOfElements)
noexcept {
39 if (NumOfElements > N) {
41 reinterpret_cast<T *
>(__kmp_allocate(NumOfElements *
sizeof(T)));
48 __kmp_free(HeapBuffer);
51 operator T *()
noexcept {
return Ptr; }
52 operator const T *()
const noexcept {
return Ptr; }