Is there a nice syntax to achieve optional named parameters?

JN 666total at wp.pl
Wed Jan 16 12:13:07 UTC 2019


On Tuesday, 15 January 2019 at 11:14:54 UTC, John Burton wrote:
>
> auto window = Window();
> window.title = "My Window";
> window.width = 1000;
> window.create();
>

You can slightly modify it to the way APIs like DirectX or Vulkan 
do it.

auto windowinfo = WindowInfo();
windowinfo.title = "My Window";
windowinfo.width = 1000;

auto window = Window(windowinfo);


More information about the Digitalmars-d-learn mailing list