These are chat archives for libmir/public

14th
May 2016
Petar Kirov
@ZombineDev
May 14 2016 15:06

Upgrading to DMD nightly worked nicely. However the constructor is a little inconvenient for my uses:

// I couldn't find an easier way to create a static array lvalues,
// so I could pass them to the `ref in size_t[PureN]` parameters
auto s = Structure!2([2, 2], [32 ,1]);
auto slice = Slice!(2, uint*)(s.lengths, s.strides, ptr);

What do you think about adding:

this(Repeat!(N, size_t) lengths, Repeat!(N, size_t) strides, PureRange range);

So that it could be used like this:

auto slice = Slice!(2, uint*)(2, 2, 32 ,1, ptr);

?

I think the other option is to change the ref to auto ref
Ilya
@9il
May 14 2016 15:07
yes, auto ref should be used
Petar Kirov
@ZombineDev
May 14 2016 15:07
And the third option is to add an overload to sliced
So which option do you prefer? I can make a PR
though I'm not sure to Phobos or to mir?
Ilya
@9il
May 14 2016 15:08
auto ref, send PR to the Phobos please
Petar Kirov
@ZombineDev
May 14 2016 15:08
k tnx bye ;)
btw auto ref or in auto ref?
Ilya
@9il
May 14 2016 15:10
you can just remove ref =)
Petar Kirov
@ZombineDev
May 14 2016 15:11
alright
Petar Kirov
@ZombineDev
May 14 2016 15:27
dlang/phobos#4325