-
#include "tensorstore/data_type.h"
-
void* tensorstore::AllocateAndConstruct(
ptrdiff_t n,
ElementInitialization initialization,
DataType r); Allocates and initializes a contiguous 1-dimensional array of
n
elements of typer
specified at run time.The memory must be freed by invoking
r->destroy
and then calling::operator delete
with an alignment ofr->alignment
.On failure to allocate memory, throws
std::bad_alloc
, or terminates the process if exceptions are disabled.Note
For primitive types, default initialization leaves the elements uninitialized.