Slice!(double*, 2, Universal) nn;
Slice!(immutable(double)*, 2, Universal) ni;
Slice!(const(double)*, 2, Universal) nc;
const Slice!(double*, 2, Universal) cn;
const Slice!(immutable(double)*, 2, Universal) ci;
const Slice!(const(double)*, 2, Universal) cc;
immutable Slice!(double*, 2, Universal) in_;
immutable Slice!(immutable(double)*, 2, Universal) ii;
immutable Slice!(const(double)*, 2, Universal) ic;
nc = nc; nc = cn; nc = in_;
nc = nc; nc = cc; nc = ic;
nc = ni; nc = ci; nc = ii;
void fun(T, size_t N)(Slice!(const(T)*, N, Universal) sl)
{
//...
}
fun(nn); fun(cn); fun(in_);
fun(nc); fun(cc); fun(ic);
fun(ni); fun(ci); fun(ii);
static assert(is(typeof(cn[]) == typeof(nc)));
static assert(is(typeof(ci[]) == typeof(ni)));
static assert(is(typeof(cc[]) == typeof(nc)));
static assert(is(typeof(in_[]) == typeof(ni)));
static assert(is(typeof(ii[]) == typeof(ni)));
static assert(is(typeof(ic[]) == typeof(ni)));
ni = ci[];
ni = in_[];
ni = ii[];
ni = ic[];
Cast to const and immutable slices in case of underlying range is a pointer.