-
#include "tensorstore/array.h"
-
template <typename Element = void,
typename Extents,
typename LayoutOrder = ContiguousLayoutOrder>
auto tensorstore::AllocateArray(
const Extents& extents,
LayoutOrder layout_order = ContiguousLayoutOrder::c,
ElementInitialization initialization = default_init,
dtype_t<Element> dtype = dtype_v<Element>); -
template <typename Element = void,
typename BoxType,
typename LayoutOrder = ContiguousLayoutOrder>
requires IsBoxLike<BoxType> &&
IsContiguousLayoutOrder<LayoutOrder, BoxType::static_rank>
SharedArray<Element, BoxType::static_rank, offset_origin>
tensorstore::AllocateArray(
const BoxType& domain,
LayoutOrder layout_order = ContiguousLayoutOrder::c,
ElementInitialization initialization = default_init,
dtype_t<Element> dtype = dtype_v<Element>); Allocates a contiguous array of the specified shape/domain and type.
The elements are constructed and initialized as specified by
initialization
.- Template Parameters:¶
- Parameters:¶
- const Extents &extents¶
A
span
-compatible array specifying the shape of the array. The element type ofextents
must be convertible without narrowing toIndex
. May also be specified as a braced list, e.g.{200, 300}
.- const BoxType &domain
The domain of the array.
- LayoutOrder layout_order = ContiguousLayoutOrder::c¶
Optional. The layout order of the allocated array. Defaults to ContiguousLayoutOrder::c.
- ElementInitialization initialization = default_init¶
Optional. Specifies the form of initialization to use.
- dtype_t<Element> dtype = dtype_v<Element>¶
Optional. Specifies the element type at run time. Must be specified if
Element
isvoid
.