endsWith - for a string vs an array of strings
bearophile via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Jan 10 15:32:46 PST 2015
Laeeth Isharc:
>> In D there is a feature that allows a function to accept both
>> an array of items and items,
> yes - it is funny there is not an overloading that accepts
> arrays
I meant this D feature:
void foo(T)(T[] items...) {
import std.stdio;
items.writeln;
}
void main() {
foo("red", "green", "blue");
foo(["red", "green", "blue"]);
auto a = ["red", "green", "blue"];
foo(a);
}
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list