Mixin Templates and Operators

Steven Schveighoffer schveiguy at gmail.com
Wed Apr 6 17:33:28 UTC 2022


On 4/6/22 12:52 PM, Adam D Ruppe wrote:
> On Wednesday, 6 April 2022 at 10:36:04 UTC, francesco.andreetto wrote:
>> Am I doing something wrong or it is impossible to use mixin templates 
>> like that?
> 
> mixin templates can't bring in operator overloads. The spec doesn't 
> really say this I think, but that's the way it has been for a long time.
> 
> It only checks for operator overloads on the direct thing itself, no 
> UFCS, no mixin template.

As I mentioned elsewhere, it does work. But the situation I think must 
be that it's only one mixin template. Probably also you can't have any 
overloads in the type itself.

Note that I also think string mixins would work perfectly fine. And UFCS 
will never work for operator overloads, but that is by design.

-Steve


More information about the Digitalmars-d-learn mailing list