July 28, 2013 Re: static foreach and inline if | ||||
---|---|---|---|---|
| ||||
Posted in reply to anonymous | On Sunday, 28 July 2013 at 09:11:55 UTC, anonymous wrote:
> On Sunday, 28 July 2013 at 08:38:40 UTC, JS wrote:
>> On Sunday, 28 July 2013 at 08:38:01 UTC, JS wrote:
>>> On Sunday, 28 July 2013 at 08:30:17 UTC, QAston wrote:
>>>> On Saturday, 27 July 2013 at 17:14:35 UTC, JS wrote:
>>>>> I'd like to have foreach and inline if in templates:
>>>>
>>>> inline if is available as std.traits.Select
>>>
>>> This doesn't work for variadic args...
>>>
>>> Something Split!(Cond, targ..., split, fargs) is what I need... where split somehow signals the split between the two.
>>
>> Obviously I mean Select!
>
> template Wrap(Stuff ...) {alias unwrap = Stuff;}
> Select!(cond, Wrap!targs, Wrap!fargs).unwrap
I tried to do that with tuple which is identical to your wrap but was not successful... possibly because I did not unwrap it...
|
July 28, 2013 Re: static foreach and inline if | ||||
---|---|---|---|---|
| ||||
Posted in reply to JS | On Sunday, 28 July 2013 at 15:33:48 UTC, JS wrote:
>
> I tried to do that with tuple which is identical to your wrap but was not successful... possibly because I did not unwrap it...
It should work. You can expand the *types* with Types, and the *values* with expand.
|
July 28, 2013 Re: static foreach and inline if | ||||
---|---|---|---|---|
| ||||
Posted in reply to JS | On Sunday, 28 July 2013 at 15:33:48 UTC, JS wrote: > On Sunday, 28 July 2013 at 09:11:55 UTC, anonymous wrote: >> On Sunday, 28 July 2013 at 08:38:40 UTC, JS wrote: [...] >> template Wrap(Stuff ...) {alias unwrap = Stuff;} >> Select!(cond, Wrap!targs, Wrap!fargs).unwrap > > I tried to do that with tuple which is identical to your wrap but was not successful... possibly because I did not unwrap it... If you're refering to that implementation of tuple: On Saturday, 27 July 2013 at 17:14:35 UTC, JS wrote: > template tuple(args...) { alias tuple = args; } That's not exactly the same. It really must not be an eponymous template. |
Copyright © 1999-2021 by the D Language Foundation