Re: Range with an alias parameter

2019-01-31 Thread Alex via Digitalmars-d-learn
On Thursday, 31 January 2019 at 02:41:00 UTC, Steven Schveighoffer wrote: Apples and oranges :) ReturnType!(produceS!(42)) is a TYPE, not a variable. When you apply the brackets, it's not calling your opindex, but rather changing it to an array. So let's make it clearer by saying: alias T =

Re: Range with an alias parameter

2019-01-30 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/30/19 3:56 PM, Alex wrote: Ok... strange... it doesn't in fact... as this works: ´´´ import std.experimental.all; void main() {     S!42 s;     auto res = s[];     static assert(isInputRange!(typeof(res)));     res.front.writeln; } //static assert(isInputRange!(ReturnType!(produceS!(

Re: Range with an alias parameter

2019-01-30 Thread Alex via Digitalmars-d-learn
On Wednesday, 30 January 2019 at 20:13:56 UTC, Alex wrote: Given this: ´´´ import std.experimental.all; void main(){} static assert(isInputRange!(ReturnType!(produceS!(42))[])); auto produceS(size_t param)() { return S!param(); } struct S(size_t param) { //@disable this(this); auto op

Range with an alias parameter

2019-01-30 Thread Alex via Digitalmars-d-learn
Given this: ´´´ import std.experimental.all; void main(){} static assert(isInputRange!(ReturnType!(produceS!(42))[])); auto produceS(size_t param)() { return S!param(); } struct S(size_t param) { //@disable this(this); auto opIndex() { return produceRange!(this); } } auto produceRange