Arguments of function as an array.
Jonathan
JonathanILevi at gmail.com
Thu Apr 26 21:28:27 UTC 2018
Is there a way in D to take past arguments as an array? A like a
normal Variadic function. All the arguments should be of the
same type just as an array.
Basically I want to allow a function like this to be called
without square brackets.
void fun(int[] intArray) {
//...
}
void main() {
fun([5,6,4]);
}
Like this:
void fun(int... intArray) {
//typeof(intArray) is `int[]`
}
void main() {
fun(5,6,4);
}
Is this doable in D?
More information about the Digitalmars-d-learn
mailing list