#include "tensorstore/array.h"
template <typename Element,
         
 DimensionIndex Rank,
         
 ArrayOriginKind OriginKind,
         
 ContainerKind CKind>
SharedElementPointer<Element> tensorstore::AllocateArrayElementsLike(
    
const StridedLayout<Rank, OriginKind, CKind>layout,
    
Indexbyte_strides,
    
IterationConstraints constraints,
    
ElementInitialization initialization = default_init,
    
dtype_t<Element> dtype = dtype_v<Element>);

Allocates an array data buffer with a layout similar to an existing strided layout.

The newly allocated array has the same Array::domain as layout.

This provides a lower-level interface where the byte strides are stored in an existing buffer. In most cases it is more convenient to use AllocateArrayLike instead`.

Parameters:
const StridedLayout<Rank, OriginKind, CKind> &layout

The existing strided layout.

out
Index *byte_strides

Pointer to array of length layout.rank() where the byte strides of the new array will be stored.

IterationConstraints constraints

If constraints.has_order_constraint(), the returned array will use constraints.order_constraint_value(). Otherwise, an order will be chosen such that the byte strides of the allocated array have the same order (with respect to their absolute values) as layout.byte_strides().

ElementInitialization initialization = default_init

Specifies the initialization type.

dtype_t<Element> dtype = dtype_v<Element>

Specifies the element type (optional if Element is non-void).