On Sunday, 4 January 2015 at 00:22:01 UTC, ixid wrote:
Why don't templates take a type from the default argument if
nothing else is supplied?
https://issues.dlang.org/show_bug.cgi?id=2803
Why don't templates take a type from the default argument if
nothing else is supplied? It would be useful to be able to use an
enum to set a default.
enum MAX = 1_000;
auto sieve(T)(T max = MAX) {
import std.bitmanip : BitArray;
BitArray n;
n.length = max;
T[]
On Sunday, 4 January 2015 at 00:22:01 UTC, ixid wrote:
Why don't templates take a type from the default argument if
nothing else is supplied? It would be useful to be able to use
an enum to set a default.
I doubt anyone's ever thought of that particular use-case. Using
your typeof(MAX)