An struct copy constructor that can cope with an AA?

mark mark at qtrac.eu
Mon Mar 9 15:49:06 UTC 2020


On Monday, 9 March 2020 at 14:45:15 UTC, Steven Schveighoffer 
wrote:
> On 3/9/20 9:23 AM, mark wrote:
>> I have this struct:
[snip]
> I would name it dup instead of copy for consistency with D. A 
> copy constructor is pretty heavy for a struct to do a complete 
> duplication of the AA. You should have to opt-in to that.
>
> -Steve

Thanks, I'd already realised I ought to rename it .dup.

Also, I only actually need to create it from the keys since I'm 
using the tags AA as a set so every value is the same. I did try 
tags.dup but got this:

src/deb.d(25,24): Error: cannot implicitly convert expression 
dup(this.tags) of type const(void[0])[string] to void[0][string]



More information about the Digitalmars-d-learn mailing list