On Monday, 13 June 2016 at 22:31:00 UTC, Simon Bürger wrote:
But as "inout" was invented to make that unneccessary I was
wondering if there is a clever way to make this work.
<snip>
Slice!(inout(T)) opSlice(size_t a, size_t b) inout
{
return Slice!(inout(T))(ptr+a, b-a);
}
Hmmm. Wouldn't just returning an inout of the Slice work?
Otherwise you'll get inner template instantiation and that can be
annoying
inout(Slice) opSlice(size_t a, size_t b) inout
{
return cast(inout(Slice)) Slice(ptr+a, b-a);
}