On Sunday, 10 August 2014 at 19:01:18 UTC, Era Scarecrow wrote:
On Sunday, 10 August 2014 at 18:58:50 UTC, Jonathan M Davis wrote:
No overloaded operators in D can be put outside of a struct or class. They have to be member functions.

If I remember right, opApply was somewhat broken and only worked correctly in a few cases. But that was 18 months ago, a lot could have happened...

I'm not aware of opApply being broken, but I never use it, since in most cases where you might use opApply, you can use ranges, and they're far more flexible. But regardless, it's not legal to declare an overloaded operator outside of the type that it's for, so whether you're talking about opApply, opBinary, opAssign, or any other overloaded operator, declaring it as a free function like the OP is trying to do isn't going to work.

- Jonathan M Davis

Reply via email to