template operator overload

Namespace rswhite4 at googlemail.com
Wed Nov 27 10:40:07 PST 2013


On Wednesday, 27 November 2013 at 17:47:13 UTC, bearophile wrote:
> 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

Too bad. Would have been really awesome.


More information about the Digitalmars-d-learn mailing list