Hello.

1st Novice question:

i want function, operates sometimes with char[], sometimes with ubyte[].
internally it works with ubyte.
i can use overloading:

void myFunc(ubyte[] arg) {...};
void myFunc(char[] arg) { ubyte[] arg2 = cast(ubyte[]) arg; ...}

It is OK. But i want 2 params (arg1, arg2),
so i need write 4 overloading functions.

I fill templated needed, can anybody show me the way?


And 2nd question:

what if additionally to written above, function shuld return ubyte[] or char[] ?
can compiler guess what return type need from code?
something like:

char[] cc = myFunc()
ubyte[] bb = myFunc()

Thanks.

Reply via email to