Hi,

What is the difference between T[] opIndex() and T[] opSlice(), which haven't parameters?

```d
struct S(T)
{
    T[] arr;
    
    T[] opIndex() => arr[];/*
    T[] opSlice() => arr;//*/
}

alias Type = int;
void main()
{
    auto s = S!Type([1,2,3]);
    auto arr = s[]; // calls s.opIndex()
    
    assert(arr == [1,2,3]);
    assert(is(typeof(arr): Type[]));
}
```

Also, is it correct to use [] when returning?

Thanks...

Reply via email to