#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 of TargetRank.

This simply uses StaticCast to convert source to the type obtained from RebindRank.

The source type must be supported by RebindRank, and both the source and target types must be supported by StaticCast.

The semantics of the Checking parameter are the same as for StaticCast.

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:
SourceRef &&source

Source value.