Range to array
Namespace
rswhite4 at googlemail.com
Fri Jun 29 16:43:44 PDT 2012
It is terrible to use a function of std.range if you are not
using "auto" as type all the time.
Why isn't there a convert function for the original type?
I know "array(Range)" of std.array is what i want, but why do i
have to import two modules to use one?
Wouldn't it be better if std.range imports std.array implicit?
Otherwise (IMO) std.range needs some convert functions like
[code]
T[] Range(alias func, T)(T[] array) {
return func(array).array();
}
T[] Range(alias func, T, U)(T[] array, U a) {
return func(array, a).array();
}
T[] Range(alias func, T, U)(T a, U b) if (!isArray!(T)) {
return func(a, b).array();
}
[/code]
or, if you prefer, in compressed (but without the type safety):
[code]
auto Range(alias func, Args...)(Args args) {
return func(args).array();
}
[/code]
I think something like that is missing in std.range.
More information about the Digitalmars-d-learn
mailing list