template operator overload

bearophile bearophileHUGS at lycos.com
Wed Nov 27 09:47:12 PST 2013


Namespace:

> void main() {
> 	A a;
> 	a.opIndex!int(0); // [1]
> 	a!int[0]; // [2]
> }
> ----
>
> [1] works, but [2] fails.
> How can I call opIndex with bracket syntax and a typename? Or 
> is this not possible?

I think that's not supported by D syntax. So if you want that, 
you need to use a syntax like "a.at!int(0)".

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list