[qvn] Why doesn't QVM use [] or () to access vector and matrix elements?

Hi, These operators could be used for views So instead of (m, http://zajo.github.io/boost-qvm/operator_mod_rationale.htmlA42) *= 42; we could have in C++11 ref(m)(4,2) *= 42; ref(m)[4][2) *= 42; In C++98 these could be less efficient than e.g. value<4,2>(m) *= 42; Best, Vicente

On Wed, Dec 9, 2015 at 3:46 PM, Vicente J. Botet Escriba < vicente.botet@wanadoo.fr> wrote:
Hi,
These operators could be used for views
So instead of
(m, http://zajo.github.io/boost-qvm/operator_mod_rationale.htmlA42) *= 42;
we could have in C++11
ref(m)(4,2) *= 42; ref(m)[4][2) *= 42;
Once you do ref(m) you can have any operator you want for accessing the elements, but that's too inconvenient, and to certain degree against the spirit of the library. In QVM you can multiply m1*m2 regardless of their exact static types, you don't have to do ref(m1)*ref(m2) to get the correct op* to kick in. What problem are we solving with this anyway? What's wrong with: (m,A42) *= 42; Emil

Le 10/12/2015 01:03, Emil Dotchevski a écrit :
On Wed, Dec 9, 2015 at 3:46 PM, Vicente J. Botet Escriba < vicente.botet@wanadoo.fr> wrote:
Hi,
These operators could be used for views
So instead of
(m, http://zajo.github.io/boost-qvm/operator_mod_rationale.htmlA42) *= 42; (sorry for the formating)
(m, A42) *= 42
we could have in C++11
ref(m)(4,2) *= 42; ref(m)[4][2) *= 42;
Once you do ref(m) you can have any operator you want for accessing the elements, but that's too inconvenient, and to certain degree against the spirit of the library. I don't see where this is against anything. In QVM you can multiply m1*m2 regardless of their exact static types, you don't have to do ref(m1)*ref(m2) to get the correct op* to kick in. I have not suggested that.
What problem are we solving with this anyway? What's wrong with:
(m,A42) *= 42;
See other post about how controversial seems to be operator,. Well I was just replaying to one of the Q/A of the doc. You say that you don't need [](). I say that on views it is the most clear thing when we use C++11. BTW, qvm::vec and qvm::mat could provide the access operators as well. Vicente
participants (2)
-
Emil Dotchevski
-
Vicente J. Botet Escriba