Copy constructor hell

9il ilyayaroshenko at gmail.com
Wed May 8 03:18:14 UTC 2019


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



More information about the Digitalmars-d mailing list