Structs are Not Plain: A call for empty struct constructors

Max Samukha maxsamukha at gmail.com
Sat Sep 21 05:18:46 UTC 2019


On Friday, 20 September 2019 at 07:53:00 UTC, Andrea Fontana 
wrote:
> class MyClass {}
>
> struct Fixture
> {
>   int i;
>   immutable MyClass c;
> }
>
> auto fixture()
> {
>   Fixture ret =
>   {
>     i : 10,
>     c : new MyClass()
>   };
>
>   return ret;
> }
>
> void main()
> {
>   with(fixture())
>   {
>
>   }
> }
>
> Andrea

How is that different from the function-as-constructor examples 
by the other posters? Anyway, the status quo is very unlikely to 
ever change, so I am shutting up.


More information about the Digitalmars-d mailing list