[Issue 16537] [ndslice] cannot use slice as in function parameter, error on opIndex

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Sep 25 22:25:53 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=16537

Илья Ярошенко <ilyayaroshenko at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ilyayaroshenko at gmail.com

--- Comment #1 from Илья Ярошенко <ilyayaroshenko at gmail.com> ---
I don't think that the problem with `in` can be solved for D2. This can be used
instead:

alias MyMatrix = Slice!(2,double*);
alias MyConstMatrix = Slice!(2, const(double)*); // should be casted in caller
function

A DIP [2] can be created to allow implicit converting MyMatrix ->
MyConstMatrix.

--- 

BTW, mir.ndslice.algorithm [1] allows to optimise you function few times. Also
http://docs.mir.dlang.io/latest/mir_ndslice_slice.html#.uninitializedSlice will
help optimization too. mir.ndslice should be used instead of std ndslice (it
should be unified soon). Comparing with fortran ndslice indexed loops can not
be vectorized, ndslice.algorithm solve this problem.

Mir requires recent LDC beta. DMD is not supported.
ldmd2 (shell on top of ldc2) should be used instead of ldc2, because dub passes
wrong optimization params to ldc2.

[1] http://docs.mir.dlang.io/latest/mir_ndslice_algorithm.html
[2] https://github.com/dlang/DIPs

--


More information about the Digitalmars-d-bugs mailing list