#include "tensorstore/data_type.h"
template <typename T = void>
std::shared_ptr<T> tensorstore::AllocateAndConstructShared(
    
ptrdiff_t n,
    
ElementInitialization initialization = default_init,
    
dtype_t<T> r = dtype_v<T>);

Returns a shared_ptr that manages the memory returned by AllocateAndConstruct.

Template Parameters:
typename T = void

Optional. The element type. If unspecified (or equal to void), the element type must be specified at run time using the r parameter.

Parameters:
ptrdiff_t n

The number of elements to allocate.

ElementInitialization initialization = default_init

Optional. The form of initialization to use.

dtype_t<T> r = dtype_v<T>

The element type. Optional if T is not void.