lundi 4 septembre 2017

Access a multi dimensional std::array via parameter pack

Is there a way to access an element of an multidimensional array via a variadic template parameter pack? I want to give the function a type dependent number of x,y, .. coordinates as function parameters and return the given array element. I think with a one dimensional array it is easy to access, but I currently wonder how to make the same for any n-dimensional array.

template <class ARRAY_CTRL_PTS, size_t DEPTH, class T, size_t ... ARGS>
T point(const T &first, const ARGS & ... other) {

} 

template <class ARRAY_CTRL_PTS, size_t DEPTH, class T>
T point(const T &last) {

} 

Aucun commentaire:

Enregistrer un commentaire