Templated opIndex?

Ola Fosheim Grøstad via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Sep 19 07:30:16 PDT 2015


And this?

auto ref qua(T)(Test t){
   struct wrap {
     Test t;
     T opIndex(int i){ return t.opIndex!T(i); }
   }
   return wrap(t);
}


void main()
{
	auto test = new Test();
	writeln(test.qua!string[0], test.qua!int[0]);
}


More information about the Digitalmars-d-learn mailing list