free function on arrays & language operations

bearophile bearophileHUGS at lycos.com
Tue Dec 7 10:23:49 PST 2010


spir:

> But: is there a way to define functions corresponding to language operations (opEquals, opIndex, toString...) without creating a true type?

You may find some trick to do something like that, but it's not how D is supposed to be used. In D operators belong in a struct/class/enum. "alias this" sometimes helps.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list