On Tuesday, 15 January 2019 at 11:14:54 UTC, John Burton wrote:
As an example let's say I have a type 'Window' that represents a win32 window. I'd like to be able to construct an instance of the type with some optional parameters that default to some reasonable settings and create the underlying win32 window.[...]
how about this
auto With(string code,T)(T value)
{
with(value)
{
mixin(code ~";");
}
return value;
}
auto window = Window().With!q{title = "My window",width =
800,fullscreen = true};
