www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Operating on a Variadic Function Parameter Set

reply =?UTF-8?B?Ik5vcmRsw7Z3Ig==?= <per.nordlow gmail.com> writes:
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.
Nov 16 2014
next sibling parent =?UTF-8?B?Ik5vcmRsw7Z3Ig==?= <per.nordlow gmail.com> writes:
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.
Nov 16 2014
prev sibling parent =?UTF-8?B?Ik5vcmRsw7Z3Ig==?= <per.nordlow gmail.com> writes:
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 :)
Nov 16 2014