-
#include "tensorstore/array.h"
-
template <typename Element, Index N0>
ArrayView<Element, 1, offset_origin>
tensorstore::MakeOffsetArrayView(span<const Index, 1> origin,
Element (&array)[N0]); -
template <typename Element, Index N0>
ArrayView<const Element, 1, offset_origin>
tensorstore::MakeOffsetArrayView(span<const Index, 1> origin,
const Element (&array)[N0]); -
template <typename Element, Index N0, Index N1>
ArrayView<Element, 2, offset_origin>
tensorstore::MakeOffsetArrayView(span<const Index, 2> origin,
Element (&array)[N0][N1]); -
template <typename Element, Index N0, Index N1>
ArrayView<const Element, 2, offset_origin>
tensorstore::MakeOffsetArrayView(span<const Index, 2> origin,
const Element (&array)[N0][N1]); Returns an
ArrayView
that points to the specified C array.Note
Only the rank-1 and rank-2 overloads are shown, but C arrays with up to 6 dimensions are supported.
- Parameters:¶
- span<const Index, 1> origin¶
- span<const Index, 2> origin
The origin vector of the array. May be specified as a braced list, e.g.
MakeOffsetArray({1, 2}, {{3, 4, 5}, {6, 7, 8}})
.- Element (&array)[N0]¶
- const Element (&array)[N0]
- Element (&array)[N0][N1]
- const Element (&array)[N0][N1]
The C array to which the returned
ArrayView
will point. May be specified as a (nested) braced list, e.g.MakeArrayView({{1, 2, 3}, {4, 5, 6}})
, in which case the inferredElement
type will beconst
-qualified.
Warning
The caller is responsible for ensuring that the returned array is not used after
array
becomes invalid.