December 12
Hi All,

 Request your help on the below code, as i ma getting the below error message

Error:
C:\D\dmd2\windows\bin\..\..\src\phobos\std\container\array.d(739): Error: template std.container.array.Array!(Tuple!(string, real)).Array.insertBack cannot dedu
ce function from argument types !()(RangeT!(Array!(Tuple!(string, SysTime)))), candidates are:
C:\D\dmd2\windows\bin\..\..\src\phobos\std\container\array.d(805):        std.container.array.Array!(Tuple!(string, real)).Array.insertBack(Stuff)(Stuff stuff)
if (isImplicitlyConvertible!(Stuff, T) || isInputRange!Stuff && isImplicitlyConvertible!(ElementType!Stuff, T))
SFtest.d(28): Error: template instance std.container.array.Array!(Tuple!(string, real)).Array.opOpAssign!("~", RangeT!(Array!(Tuple!(string, SysTime)))) error i
nstantiating
SFtest.d(33):        instantiated from here: MN1!(Array!(Tuple!(string, SysTime)))
C:\D\dmd2\windows\bin\..\..\src\phobos\std\container\array.d(739): Error: template std.container.array.Array!(Tuple!(string, SysTime)).Array.insertBack cannot d
educe function from argument types !()(RangeT!(Array!(Tuple!(string, real)))), candidates are:
C:\D\dmd2\windows\bin\..\..\src\phobos\std\container\array.d(805):        std.container.array.Array!(Tuple!(string, SysTime)).Array.insertBack(Stuff)(Stuff stuf
f) if (isImplicitlyConvertible!(Stuff, T) || isInputRange!Stuff && isImplicitlyConvertible!(ElementType!Stuff, T))
SFtest.d(25): Error: template instance std.container.array.Array!(Tuple!(string, SysTime)).Array.opOpAssign!("~", RangeT!(Array!(Tuple!(string, real)))) error i
nstantiating
SFtest.d(34):        instantiated from here: MN1!(Array!(Tuple!(string, real)))
Failed: ["dmd", "-v", "-o-", "SFtest.d", "-I."]

Program:

import std.stdio: writefln, writeln;
import std.traits: ReturnType;
import std.file: SpanMode, dirEntries, isDir, isFile;
import std.algorithm: filter, map, sort;
import std.typecons: Tuple, tuple;
import std.parallelism: parallel, taskPool;
import std.container.array;
import std.datetime.systime: SysTime;
import std.string;

auto FN1(string FFs) {
	auto dFiles = Array!(Tuple!(string, SysTime))(dirEntries(FFs, SpanMode.depth).filter!(a => a.isFile).map!(a => tuple(a.name, a.timeCreated)));
	return dFiles;
}
auto FN2(string FFs) {
	auto dFiles = Array!(Tuple!(string, real))(dirEntries(FFs, SpanMode.depth).filter!(a => a.isFile).map!(a => tuple(a.name, a.size.to!real)));
	return dFiles;
}
void MN1(T)(T function(string) coRoutine, Array!string Dirlst) {
alias scRType = typeof(coRoutine(string.init));
auto PFresult = taskPool.workerLocalStorage!scRType();
foreach (string FFs;  parallel(Dirlst[0 .. $],1)) { PFresult.get ~= coRoutine(FFs.strip); }
/* ### Function Call 1 ### */ //If this works the below Function does not work
ReturnType!FN1 rFN1data;
foreach(i; PFresult.toRange) { rFN1data ~= i[][]; }
if (!rFN1data[].empty) { writefln("%(%-(%-63s %s %)\n%)", rFN1data[].sort!((a,b) => a[1] > b[1])); }
/* ### Function Call 2 ### */ //If this works the above Function does not work
ReturnType!FN2 rFN2data;
foreach(i; PFresult.toRange) { rFN2data ~= i[][]; }
if (!rFN2data[].empty) { writefln("%(%-(%-63s %s %)\n%)", rFN2data[].sort!((a,b) => a[1] > b[1])); }
}
void main () {
auto Dirlst = Array!string ("C:\\Temp\\BACKUP", "C:\\Temp\\EXPORT");
MN1(&FN1, Dirlst);
MN1(&FN2, Dirlst);
}

From,
Vino.B
December 12
On Tuesday, 12 December 2017 at 14:25:22 UTC, Vino wrote:
> Hi All,
>
>  Request your help on the below code, as i ma getting the below error message
>
> [...]

Hi All,

 Was able to resolve this issue, it was my mistake, sorry.

From,
Vino.B