Skip to main content
added 255 characters in body
Source Link
AnT stands with Russia
  • 322.5k
  • 44
  • 548
  • 793

You declared your copy constructor explicit (BTW, why?), which means that it can no longer be used for implicit copying of class objects. In order to use this constructor for copying you are now forced to use direct-initialization syntax. See 12.3.1/2

2 An explicit constructor constructs objects just like non-explicit constructors, but does so only where the direct-initialization syntax (8.5) or where casts (5.2.9, 5.4) are explicitly used.

The issue can be illustrated by the following much shorter example

struct A { A() {} explicit A(const A&) {} }; int main() { A a; A b = a; // ERROR: copy-initialization A c(a); // OK: direct-initialization } 

This is what blocks all of your conversions from working, since all of them rely on copy-initialization, which in turns relies on implicit copying. And you disabled implicit copying.

Additionally, see the Defect Report #152 which covers this specific issue. Although I'm not sure what the consequences of the "proposed resolution" are supposed to be...

You declared your copy constructor explicit (BTW, why?), which means that it can no longer be used for implicit copying of class objects. In order to use this constructor for copying you are now forced to use direct-initialization syntax. See 12.3.1/2

2 An explicit constructor constructs objects just like non-explicit constructors, but does so only where the direct-initialization syntax (8.5) or where casts (5.2.9, 5.4) are explicitly used.

The issue can be illustrated by the following much shorter example

struct A { A() {} explicit A(const A&) {} }; int main() { A a; A b = a; // ERROR: copy-initialization A c(a); // OK: direct-initialization } 

This is what blocks all of your conversions from working, since all of them rely on copy-initialization, which in turns relies on implicit copying. And you disabled implicit copying.

You declared your copy constructor explicit (BTW, why?), which means that it can no longer be used for implicit copying of class objects. In order to use this constructor for copying you are now forced to use direct-initialization syntax. See 12.3.1/2

2 An explicit constructor constructs objects just like non-explicit constructors, but does so only where the direct-initialization syntax (8.5) or where casts (5.2.9, 5.4) are explicitly used.

The issue can be illustrated by the following much shorter example

struct A { A() {} explicit A(const A&) {} }; int main() { A a; A b = a; // ERROR: copy-initialization A c(a); // OK: direct-initialization } 

This is what blocks all of your conversions from working, since all of them rely on copy-initialization, which in turns relies on implicit copying. And you disabled implicit copying.

Additionally, see the Defect Report #152 which covers this specific issue. Although I'm not sure what the consequences of the "proposed resolution" are supposed to be...

deleted 53 characters in body
Source Link
AnT stands with Russia
  • 322.5k
  • 44
  • 548
  • 793

Most of the code you posted are hardly relevant.

You declared your copy constructor explicit (BTW, why?), which means that it can no longer be used for implicit copying of class objects. In order to use this constructor for copying you are now forced to use direct-initialization syntax. See 12.3.1/2

2 An explicit constructor constructs objects just like non-explicit constructors, but does so only where the direct-initialization syntax (8.5) or where casts (5.2.9, 5.4) are explicitly used.

The issue can be illustrated by the following much shorter example

struct A { A() {} explicit A(const A&) {} }; int main() { A a; A b = a; // ERROR: copy-initialization A c(a); // OK: direct-initialization } 

This is what blocks all of your conversions from working, since all of them rely on copy-initialization, which in turns relies on implicit copying. And you disabled implicit copying.

Most of the code you posted are hardly relevant.

You declared your copy constructor explicit (BTW, why?), which means that it can no longer be used for implicit copying of class objects. In order to use this constructor for copying you are now forced to use direct-initialization syntax. See 12.3.1/2

2 An explicit constructor constructs objects just like non-explicit constructors, but does so only where the direct-initialization syntax (8.5) or where casts (5.2.9, 5.4) are explicitly used.

The issue can be illustrated by the following much shorter example

struct A { A() {} explicit A(const A&) {} }; int main() { A a; A b = a; // ERROR: copy-initialization A c(a); // OK: direct-initialization } 

This is what blocks all of your conversions from working, since all of them rely on copy-initialization, which in turns relies on implicit copying. And you disabled implicit copying.

You declared your copy constructor explicit (BTW, why?), which means that it can no longer be used for implicit copying of class objects. In order to use this constructor for copying you are now forced to use direct-initialization syntax. See 12.3.1/2

2 An explicit constructor constructs objects just like non-explicit constructors, but does so only where the direct-initialization syntax (8.5) or where casts (5.2.9, 5.4) are explicitly used.

The issue can be illustrated by the following much shorter example

struct A { A() {} explicit A(const A&) {} }; int main() { A a; A b = a; // ERROR: copy-initialization A c(a); // OK: direct-initialization } 

This is what blocks all of your conversions from working, since all of them rely on copy-initialization, which in turns relies on implicit copying. And you disabled implicit copying.

Source Link
AnT stands with Russia
  • 322.5k
  • 44
  • 548
  • 793

Most of the code you posted are hardly relevant.

You declared your copy constructor explicit (BTW, why?), which means that it can no longer be used for implicit copying of class objects. In order to use this constructor for copying you are now forced to use direct-initialization syntax. See 12.3.1/2

2 An explicit constructor constructs objects just like non-explicit constructors, but does so only where the direct-initialization syntax (8.5) or where casts (5.2.9, 5.4) are explicitly used.

The issue can be illustrated by the following much shorter example

struct A { A() {} explicit A(const A&) {} }; int main() { A a; A b = a; // ERROR: copy-initialization A c(a); // OK: direct-initialization } 

This is what blocks all of your conversions from working, since all of them rely on copy-initialization, which in turns relies on implicit copying. And you disabled implicit copying.