Boost logo

Boost :

Subject: Re: [boost] [qvn] Why doesn't QVM use [] or () to access vector and matrix elements?
From: Emil Dotchevski (emil_at_[hidden])
Date: 2015-12-09 19:03:57


On Wed, Dec 9, 2015 at 3:46 PM, Vicente J. Botet Escriba <
vicente.botet_at_[hidden]> wrote:

> Hi,
>
> These operators could be used for views
>
> So instead of
>
> (m, <http://zajo.github.io/boost-qvm/operator_mod_rationale.html>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. 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


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk