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

◆ coordinates()

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

Computes a tuple of coordinates 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 std::array<shape<Desc>::value_type, shape<Desc>::static_order> containing the multi-dimensional position corresponding to idx