-
#include "tensorstore/array.h"
-
template <ArrayOriginKind TargetOriginKind,
ContainerKind LayoutContainerKind = view,
typename A>
requires IsArray<std::remove_cvref_t<A>> &&
(!IsArrayOriginKindConvertible(
std::remove_cvref_t<A>::array_origin_kind,
TargetOriginKind))
Result<Array<typename std::remove_cvref_t<A>::ElementTag,
std::remove_cvref_t<A>::static_rank,
TargetOriginKind,
LayoutContainerKind>> tensorstore::
ArrayOriginCast(A&& array); -
template <ArrayOriginKind TargetOriginKind,
ContainerKind LayoutContainerKind = view,
typename A>
requires IsArray<std::remove_cvref_t<A>> &&
(IsArrayOriginKindConvertible(
std::remove_cvref_t<A>::array_origin_kind,
TargetOriginKind))
Array<typename std::remove_cvref_t<A>::ElementTag,
std::remove_cvref_t<A>::static_rank,
TargetOriginKind,
LayoutContainerKind> tensorstore::ArrayOriginCast(A&& array); Converts an array to the specified origin kind.
- Template Parameters:¶
- ArrayOriginKind TargetOriginKind¶
Specifies the new origin kind. If equal to
zero_origin
andarray.array_origin_kind == offset_origin
, the array is translated to have a zero origin. Otherwise, the origin remains the same.- ContainerKind LayoutContainerKind = view¶
Specifies the new layout container kind. If equal to
view
, the layout of the returned array is only valid as long asarray.layout()
.
- Returns:¶
The adjusted array.
- Error absl::StatusCode::kInvalidArgument:¶
if
TargetOriginKind == zero_origin
,array.array_origin_kind == offset_origin
, andarray.shape()
contains an extent that exceedskInfIndex
(which would result in an upper bound outside the valid range forIndex
).