lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Overloading the call operator is used in several competitive C++ matrix arithmetic packages, e.g. the redoubtable Eigen.

Regards,
Mike Gogins

On Mon, Apr 18, 2011 at 12:28 PM, Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br> wrote:
> Matrix accessor is my big big pain!!! The option M[x][y] is highly
> inefficient but somewhat convenient. I'm using the direct access
> M[M.pitch * y + x] for optimized routine but I propose the syntax:
>
> m:get(i, j)
>
> to the user. Quite ugly but I don't have anything better.

How about using __call and writing m(i,j)?




--
Michael Gogins
Irreducible Productions
http://www.michael-gogins.com
Michael dot Gogins at gmail dot com