Is there a nice syntax to achieve optional named parameters?

John Burton john.burton at jbmail.com
Fri Jan 18 09:39:31 UTC 2019


On Thursday, 17 January 2019 at 01:43:42 UTC, SrMordred wrote:

> struct Config
> {
> 	string title;
> 	int width;
> }
>
> struct Window
> {
> 	this(Config config)

It likely is a bad idea for a small struct like this but if it 
was much bigger would it makes sense to write this as :-

	this(const ref Config config)

Which is what you might do in C++ or does D handle this 
differently?



More information about the Digitalmars-d-learn mailing list