-
#include "tensorstore/rank.h"
-
template <DimensionIndex TargetRank,
CastChecking Checking = CastChecking::checked,
typename SourceRef>
StaticCastResultType<RebindRank<SourceRef, TargetRank>,
SourceRef,
Checking>
tensorstore::StaticRankCast(SourceRef&& source); Casts
source
to have a static rank ofTargetRank
.This simply uses
StaticCast
to convertsource
to the type obtained fromRebindRank
.The source type must be supported by
RebindRank
, and both the source and target types must be supported byStaticCast
.The semantics of the
Checking
parameter are the same as forStaticCast
.Example:
StaticRank<3> r_static = StaticRankCast<3, unchecked>(DimensionIndex(3)); Box<> box = ...; Result<Box<3>> checked_result = StaticRankCast<3>(box); Box<3> unchecked_result = StaticRankCast<3, unchecked>(box);
- Template Parameters:¶
- DimensionIndex TargetRank¶
Target rank value.
- CastChecking Checking = CastChecking::checked¶
Specifies whether the cast is checked or unchecked.
- Parameters:¶