Re: constructing labels for static foreach inside switch inside foreach

2020-07-08 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/8/20 9:38 AM, ag0aep6g wrote: On 08.07.20 14:24, Steven Schveighoffer wrote: I solved it for now by extrapolating the inner code into a local template function. But this is definitely an awkward situation for static foreach. FWIW, you can write the extra function like this:     static

Re: constructing labels for static foreach inside switch inside foreach

2020-07-08 Thread ag0aep6g via Digitalmars-d-learn
On 08.07.20 14:24, Steven Schveighoffer wrote: I solved it for now by extrapolating the inner code into a local template function. But this is definitely an awkward situation for static foreach. FWIW, you can write the extra function like this: static foreach (T; Types) () { i

Re: constructing labels for static foreach inside switch inside foreach

2020-07-08 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/8/20 6:13 AM, Stanislav Blinov wrote: On Wednesday, 8 July 2020 at 02:06:01 UTC, Steven Schveighoffer wrote: Seems simple enough, except that this inner portion is unrolled, and if I have more than one type to run this on, I already have an "innerloop" label defined. Is there a way to d

Re: constructing labels for static foreach inside switch inside foreach

2020-07-08 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/8/20 5:10 AM, cc wrote: I think I ran into similar problems due to the requirement to use a labeled break inside static foreach.  I got around it by defining enums when my target was found and checking if it existed via __traits(compiles) to "ignore" the rest of the loop. Thanks for th

Re: constructing labels for static foreach inside switch inside foreach

2020-07-08 Thread Stanislav Blinov via Digitalmars-d-learn
On Wednesday, 8 July 2020 at 02:06:01 UTC, Steven Schveighoffer wrote: Seems simple enough, except that this inner portion is unrolled, and if I have more than one type to run this on, I already have an "innerloop" label defined. Is there a way to define a label using a mixin or something? o

Re: constructing labels for static foreach inside switch inside foreach

2020-07-08 Thread cc via Digitalmars-d-learn
On Wednesday, 8 July 2020 at 02:06:01 UTC, Steven Schveighoffer wrote: OK, so I have a situation where I'm foreaching over a compile-time list of types. Inside the loop, I'm using a second loop over a set of input. Inside that loop, I'm using a switch on the input, and inside the switch, I'm

Re: constructing labels for static foreach inside switch inside foreach

2020-07-07 Thread bauss via Digitalmars-d-learn
On Wednesday, 8 July 2020 at 02:06:01 UTC, Steven Schveighoffer wrote: OK, so I have a situation where I'm foreaching over a compile-time list of types. Inside the loop, I'm using a second loop over a set of input. Inside that loop, I'm using a switch on the input, and inside the switch, I'm