Copy constructor hell

RazvanN razvan.nitu1305 at gmail.com
Wed May 8 09:05:48 UTC 2019


On Wednesday, 8 May 2019 at 03:18:14 UTC, 9il wrote:
> Hi,
>
> Just tried to upgrade mir-algorithm with the copy constructor.
>
> Mir has only a few types that should define copy constructors 
> explicitly.
>
> However, Slice (main structure ) and more than 30 internal 
> generic types like Iterators and Fields should be upgraded now 
> as well. The compiler adds an automatically generated 
> constructor. So, default structure construction that worked 
> before, would not work anymore:
>
> struct S(T)
> {
>     T t;
> }
>
> T oneT;
>
> S(oneT); // would not work anymore if T has a copy constructor.
>
> So, it is a big breaking change for user code as well.
>
> Can we fix it at least for types that have compiler generated 
> copy-constructors?
>
> Best,
> Ilya

What is the signature of the copy constructor that you have 
defined? Have you tried the this(inout typeof(this)) inout one?


More information about the Digitalmars-d mailing list