opIndexDispatch?

Yuxuan Shui via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Oct 12 15:45:28 PDT 2016


On Monday, 10 October 2016 at 19:16:06 UTC, Jonathan M Davis 
wrote:
> On Monday, October 10, 2016 19:01:19 Yuxuan Shui via 
> Digitalmars-d-learn wrote:
>> Hi,
>>
>> Why is there no opIndexDispatch for overloading a[x].func() ?
>
> There's opIndex for overloading a[x], and then you can call a 
> function on the return value. If you want some kind of 
> opDispatch on the return value, then the return type will need 
> to implement opDispatch.
>
> - Jonathan M Davis

The opIndex* overloads are used for handling the case where the 
key is not already in the data structure, right?


More information about the Digitalmars-d-learn mailing list