On Fri, 18 Jan 2019 09:39:31 +0000, John Burton wrote:
> 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?

Creating a window is the dominating cost here. If you're creating enough 
windows that copying them is a problem, you're doing something seriously 
weird and it might be more productive to step back and think about that 
than to switch to const ref.

Reply via email to