logical operands on strings

Erik van Velzen erik at evanv.nl
Sun Jan 12 10:37:38 PST 2014


On Sunday, 12 January 2014 at 18:28:38 UTC, Meta wrote:
>
> It looks like your opBinary on strings is an attempt at 
> globally overriding the XOR operator. I'm almost 100% sure this 
> won't work in D. All operator overloads have to be part of a 
> class or struct.

How would I do that without rewriting an entire string class? It 
seems I can't even inherit from string.

Forgive me for making the comparison, but I believe in C++ i can 
simply implement this function and be done with it:

     string operator^(string lhs, string rhs);


More information about the Digitalmars-d-learn mailing list