Kiwaku 0.1-beta
Containers Well Made
 
Loading...
Searching...
No Matches

◆ coordinates_to_position()

template<std::integral Idx, auto... Desc>
constexpr auto kwk::coordinates_to_position ( Idx  idx,
shape< Desc... > const  shp 
)
constexprnoexcept

Computes a kiwaku position from a linear index and a shape.

Behavior is undefined if idx is out of the index space defined by shp.

Parameters
idxLinear index to convert into a nD coordinate set
shpShape used as a reference
Returns
A kwk::position<shape<Desc...>::static_order> containing the multi-dimensional position corresponding to idx