Skip to content

Instantly share code, notes, and snippets.

@Leandros
Created February 3, 2018 11:30
Show Gist options
  • Save Leandros/69268e768f8a30c85dee1c6861b3d145 to your computer and use it in GitHub Desktop.
Save Leandros/69268e768f8a30c85dee1c6861b3d145 to your computer and use it in GitHub Desktop.
/* ... */
template<size_t Dimen>
class NDMatrix
{
public:
/* this is imaginary, as of right now: */
$for(size_t i = 0; i < Dimen; ++i) {
/* Create one function definition for each dimen access:
* float &At(int x0, int x1, etc...) { return m_array[_At(...)]; }
*/
}
private:
size_t
_At(int indices[Dimen])
{
/* calculate the correct index for access into linear array here . */
return idx;
}
};
/* ... */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment