Re: Why doesn't `opAssign` work for my templated struct?

2024-11-09 Thread Nick Treleaven via Digitalmars-d-learn
On Saturday, 9 November 2024 at 12:33:44 UTC, Nick Treleaven wrote: On Friday, 8 November 2024 at 21:55:53 UTC, Liam McGillivray wrote: Milligrams mass = Milligrams(20f); I'm not sure why that compiles. Filed: https://issues.dlang.org/show_bug.cgi?id=24850

Re: Why doesn't `opAssign` work for my templated struct?

2024-11-09 Thread kdevel via Digitalmars-d-learn
On Friday, 8 November 2024 at 21:55:53 UTC, Liam McGillivray wrote: I am working on a library for making types representing units of measurement. Base units [...] ``` [...] enum Milligrams : BaseUnit!Milligrams; enum Millimoles : BaseUnit!Millimoles; [...] ``` Shouldn't (base) units be named

Re: Why doesn't `opAssign` work for my templated struct?

2024-11-09 Thread Nick Treleaven via Digitalmars-d-learn
On Friday, 8 November 2024 at 21:55:53 UTC, Liam McGillivray wrote: enum Milligrams : BaseUnit!Milligrams; enum Millimoles : BaseUnit!Millimoles; These are forward declarations of enumeration types (aka opaque enums). These types do not inherit from the BaseUnit struct. Declaring the base typ