Passing Function as an argument to another Function

Vino vino.bheeman at hotmail.com
Mon Dec 4 12:52:10 UTC 2017


On Monday, 4 December 2017 at 11:41:06 UTC, codephantom wrote:
> On Monday, 4 December 2017 at 11:30:02 UTC, codephantom wrote:
>> On Monday, 4 December 2017 at 11:05:22 UTC, Vino wrote:
>>>  The original program is as below
>>>
>>> Error:
>>>
>>> FunTest.d(52): Error: template FunTest.ptProcessFiles cannot 
>>> deduce function from argument types !()(string, 
>>> Array!(Tuple!(string, string)) function(string FFs,
>>>  string Step, int DirAged), File, File, string, int),
>>
>> //auto CleanDirlst = "C:\\Temp\\BACKUP, C:\\Temp\\EXPORT";
>> Array!string CleanDirlst = ["C:\\Temp\\BACKUP, 
>> C:\\Temp\\EXPORT"];
>
> grrr...
>
> //auto CleanDirlst = "C:\\Temp\\BACKUP, C:\\Temp\\EXPORT";
> Array!string CleanDirlst = ["C:\\Temp\\BACKUP", 
> "C:\\Temp\\EXPORT"];

Hi,

  Thank you very much, request your help on 2 further questions

Q1 :
if the Variable  CleanDirlst is defined as "auto" can we define 
"auto" as below(auto Dirlst).

void ptProcessFiles() (auto Dirlst,  Array!(Tuple!(string, 
string)) function(string, string, int) coRoutine, File logF, File 
logE, string Step, int Aged)

Q2 :
How do we define an "auto" function(auto function(string, string, 
int) coRoutine)
void ptProcessFiles() (auto Dirlst,  auto function(string, 
string, int) coRoutine, File logF, File logE, string Step, int 
Aged)

From,
Vino.B



More information about the Digitalmars-d-learn mailing list