Re: Function Template for Dynamic Parameter

2018-07-06 Thread Timoses via Digitalmars-d-learn
On Thursday, 5 July 2018 at 16:23:36 UTC, vino.B wrote: Hi All, Request your help on the below code auto coCleanFiles(T ...) (T FFs) { auto dFiles = Array!(Tuple!(string, SysTime))(dirEntries(FFs, SpanMode.depth).map!(a => tuple(a.name, a.timeCreated))); return dFiles; } void

Re: Function Template for Dynamic Parameter

2018-07-05 Thread vino.B via Digitalmars-d-learn
On Sunday, 1 July 2018 at 12:46:30 UTC, Timoses wrote: On Sunday, 1 July 2018 at 11:58:30 UTC, vino.B wrote: On Sunday, 1 July 2018 at 11:52:19 UTC, Alex wrote: NewType.d(19): Error: function declaration without return type. (Note that constructors are always named this) [...] auto

Re: Function Template for Dynamic Parameter

2018-07-01 Thread Timoses via Digitalmars-d-learn
On Sunday, 1 July 2018 at 11:58:30 UTC, vino.B wrote: On Sunday, 1 July 2018 at 11:52:19 UTC, Alex wrote: NewType.d(19): Error: function declaration without return type. (Note that constructors are always named this) [...] auto coCleanFiles(T ...)(T args) { auto dFiles =

Re: Function Template for Dynamic Parameter

2018-07-01 Thread Timoses via Digitalmars-d-learn
On Sunday, 1 July 2018 at 11:19:50 UTC, vino.B wrote: On Sunday, 1 July 2018 at 09:55:34 UTC, Timoses wrote:> Hi Timoses, Thank you very much, can you help me on how to rewrite the below using Variadic template Passing function as a parameter to another function: void ptFun(T)(T

Re: Function Template for Dynamic Parameter

2018-07-01 Thread vino.B via Digitalmars-d-learn
On Sunday, 1 July 2018 at 11:52:19 UTC, Alex wrote: On Sunday, 1 July 2018 at 11:19:50 UTC, vino.B wrote: Hi Timoses, Thank you very much, can you help me on how to rewrite the below using Variadic template Passing function as a parameter to another function: void ptFun(T)(T

Re: Function Template for Dynamic Parameter

2018-07-01 Thread Alex via Digitalmars-d-learn
On Sunday, 1 July 2018 at 11:19:50 UTC, vino.B wrote: Hi Timoses, Thank you very much, can you help me on how to rewrite the below using Variadic template Passing function as a parameter to another function: void ptFun(T)(T function(string, string, int) coRoutine, Array!string Dirlst, )

Re: Function Template for Dynamic Parameter

2018-07-01 Thread vino.B via Digitalmars-d-learn
On Sunday, 1 July 2018 at 09:55:34 UTC, Timoses wrote: On Sunday, 1 July 2018 at 09:46:32 UTC, vino.B wrote: All, Request your help, the D document states that "Template functions are useful for avoiding code duplication - instead of writing several copies of a function, each with a

Re: Function Template for Dynamic Parameter

2018-07-01 Thread Timoses via Digitalmars-d-learn
On Sunday, 1 July 2018 at 09:46:32 UTC, vino.B wrote: All, Request your help, the D document states that "Template functions are useful for avoiding code duplication - instead of writing several copies of a function, each with a different parameter type, a single function template can be