Define a new custom operator in D Language.

Imperatorn johan_forsberg_86 at hotmail.com
Mon Oct 2 20:42:03 UTC 2023


On Monday, 2 October 2023 at 19:28:32 UTC, BoQsc wrote:
> On Monday, 2 October 2023 at 18:39:41 UTC, Imperatorn wrote:
>> On Monday, 2 October 2023 at 18:34:13 UTC, BoQsc wrote:
>>> [...]
>>
>> https://dlang.org/spec/operatoroverloading.html#binary
>
>
> Overloading seems to only overload behaviour of existing 
> operator, like:
>
> ```
> +	-	*	/	%	^^	&
> |	^	<<	>>	>>>	~	in
>
> ```
>
> I'm unable to see how the operator overloading would allow to 
> define a new custom  operator.

I guess I don't understand your confusion. % is the modulus 
operator, you can overload it if you want to instead do what you 
want according to your needs.


More information about the Digitalmars-d-learn mailing list