Passing array as an function argument.

Vino.B via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Sep 11 04:58:18 PDT 2017


Hi All,

   Can some one help me on how to pass a container array as a 
function argument , the below code throws an error,

Error: Error: function T3.Test2 (Array!string t1) is not callable 
using argument types (RangeT!(Array!string))

import std.stdio: writeln;
import std.container;

auto Test2 (Array!string t1) {
return t1;
}

auto Test1 () {
auto Fs = Array!string("C:\\Temp\\TEST1\\BACKUP", 
"C:\\Temp\\TEST2\\EXPORT");
return Fs[];
}
void main () {
auto t1 = Test1[];
Test2(t1);
}

From,
Vino.B



More information about the Digitalmars-d-learn mailing list