Go and generic programming on reddit, also touches on D
dsimcha
dsimcha at yahoo.com
Sun Sep 18 13:21:26 PDT 2011
On 9/18/2011 4:16 PM, Timon Gehr wrote:
> What would it return?
A dummy type, e.g.:
struct Repeat(T) {
T val;
T front() @property { return val; }
void popFront() {}
enum empty = false;
static struct Dollar {}
Dollar opDollar() {
return Dollar.init;
}
auto opSlice(size_t lower, Dollar dollar) { return this; }
}
void main() {
auto r = Repeat!int(1);
auto r2 = r[666..$];
}
More information about the Digitalmars-d
mailing list