Re: Function accepts const ubyte[], const char[], immutable ubyte[], immutable char[]

2016-01-10 Thread zabruk70 via Digitalmars-d-learn
On Sunday, 10 January 2016 at 14:17:28 UTC, Adam D. Ruppe wrote: A `const(void)[]` type can accept any array as input. void[] is Ah, how i can forget about void[] ! Thanks Adam!

Re: Function accepts const ubyte[], const char[], immutable ubyte[], immutable char[]

2016-01-10 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 10 January 2016 at 10:10:46 UTC, zabruk70 wrote: void myFunc(char[] arg) { ubyte[] arg2 = cast(ubyte[]) arg; ...} void myFunc(const(void)[] arg) { const(ubyte)[] arg2 = cast(const(ubyte)[]) arg; // use arg2 } A `const(void)[]` type can accept any array as input. void[] is a

Re: Function accepts const ubyte[], const char[], immutable ubyte[], immutable char[]

2016-01-10 Thread zabruk70 via Digitalmars-d-learn
On Sunday, 10 January 2016 at 11:13:00 UTC, Tobi G. wrote: ubyte[] myFunc(T1,T2)(T1[] a, T2[] b) Tobi, big thanks!!! I should learn templates...

Re: Function accepts const ubyte[], const char[], immutable ubyte[], immutable char[]

2016-01-10 Thread Tobi G. via Digitalmars-d-learn
On Sunday, 10 January 2016 at 10:10:46 UTC, zabruk70 wrote: 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 = cas

Function accepts const ubyte[], const char[], immutable ubyte[], immutable char[]

2016-01-10 Thread zabruk70 via Digitalmars-d-learn
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, ar