My name is Cesar OHANESSIAN, a C++ enthusiast. I am currently working on the implementation of a multidimensional array, the purpose being to extend std::array while being adaptable to most of the usual conventions (row/col vector, row/col major). I would like to allow people to mix the conventions, not only for compatibility reasons but also for local optimization purposes, for example:
- the matrix-vector product in col vector/row major gives 3 independent std::inner_product with contiguous iterators
- the recopy of a specific basis vector is a simple memcpy in col vector/col major (or in row vector/row major).
With that in mind, iterating over two arrays with different conventions is intrinsically sub optimal in memory and is a deciding factor to keep or reject a local optimization regarding its compatibility impact (when doing std::copy, std::equal).
I would like to tell the compiler to choose between different iterator implementations (all the stride order permutations) which are all equivalent in their defined behavior, following some policies (memory space/execution speed). It's a low level decision, depending on various fixed costs including the iterator implementation itself (dealing with for loops and counters). It would be pleasant to have a standard way for taking benefit of the compiler decisions, allowing more flexibility at compile time => each template instantiation has a unique solution so we shouldn't have to perform infinite experimental plans ! Does such a feature exist ?
Thank you in advance, you people are doing a formidable work and I owe you so much !