On Thursday, 19 August 2021 at 03:32:47 UTC, Jesse Phillips wrote:
On Thursday, 19 August 2021 at 03:29:03 UTC, Jesse Phillips
wrote:
On Tuesday, 17 August 2021 at 12:33:03 UTC, Ferhat Kurtulmuş
wrote:
On Tuesday, 17 August 2021 at 12:26:36 UTC, jfondren wrote:
On Tuesday, 17 August 2021 at 12:21:31 UTC, Ferhat Kurtulmuş
wrote:
[...]
This one's not in std.traits:
```d
import std.range : ElementType;
struct Point { int x, y; }
unittest {
Point[] points;
assert(is(ElementType!(typeof(points)) == Point));
}
```
Hey, thank you again but, I don't want an instance of Point[]
I need:
alias T = Point[];
alias ElementOfPointSlice = .... // element type of T
Sorry last post was not complete. Not tested.
```
alias T = Point[];
alias ElementOfPointSlice = ElementType!(T);
unittest {
assert(is(ElementOfPointSlice == Point));
}
```
so, what's the problem? This passes tests:
```d
import std.range : ElementType;
struct Point { int x, y; }
alias T = Point[];
alias ElementOfPointSlice = ElementType!(T);
unittest {
assert(is(ElementOfPointSlice == Point));
}
```