| Thread overview |
|---|
November 16, 2014 Operating on a Variadic Function Parameter Set | ||||
|---|---|---|---|---|
| ||||
If I have a variadic function such as in
haystack.find(needles)
what options do I have for defining needles in compile-time outside of this expression and call find() with this definition as arguments possibly multiple-times?
Is std.typecons.Tuple my only option here?
Further, is it possible to operate on this parameter set in compile-time such as in my case reversing all the arguments before feeding them as a variadic set of function parameters?
I need this in my module
https://github.com/nordlow/justd/blob/master/skip_ex.d#L122
when implementing skipOverBackShortestOf who needs to call retro on each of the needles.
| ||||
November 16, 2014 Re: Operating on a Variadic Function Parameter Set | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Nordlöw | On Sunday, 16 November 2014 at 11:40:16 UTC, Nordlöw wrote:
> If I have a variadic function such as in
>
> haystack.find(needles)
>
> what options do I have for defining needles in compile-time outside of this expression and call find() with this definition as arguments possibly multiple-times?
I just found out that Tuple member expand does what I want here.
| |||
November 16, 2014 Re: Operating on a Variadic Function Parameter Set | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Nordlöw | On Sunday, 16 November 2014 at 11:40:16 UTC, Nordlöw wrote: > If I have a variadic function such as in > > haystack.find(needles) > > what options do I have for defining needles in compile-time outside of this expression and call find() with this definition as arguments possibly multiple-times? > > Is std.typecons.Tuple my only option here? > > Further, is it possible to operate on this parameter set in compile-time such as in my case reversing all the arguments before feeding them as a variadic set of function parameters? > > I need this in my module > > https://github.com/nordlow/justd/blob/master/skip_ex.d#L122 > > when implementing skipOverBackShortestOf who needs to call retro on each of the needles. I cracked skipOverBackShortestOf too at https://github.com/nordlow/justd/blob/master/skip_ex.d#L133 :) | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply