0

Is this a technical requirement that it cannot be done by the compiler in any way or pure security-wise suggestion that is enforced?

Stack Player
  • 1,470
  • 2
  • 18
  • 32
Etherealone
  • 3,488
  • 2
  • 37
  • 56

1 Answers1

1

No, the reason is not technical.

The auto-generated special member functions are designed to act somewhat like POD/C-style struct similar operations, but extended. This makes C++ types act slightly more uniformly.

But not all types should behave that way. C++ stops auto generating some according to rules set down in the standard for purely language/code design reasons -- it was decided removing them was better than leaving them in to be called by surprise or through inexperience. Probably had the language been designed today, the rule or 3/5 would be explicit in how member function auto generation is implicitly disabled.

C++11 adds =default as a way, among other things, to bring them back.

Move special member functions both had to deal with C++03 backward compatibility, and not breaking existing code. There is no technical barrier here either, just language design and backward compatability issues.

Yakk - Adam Nevraumont
  • 262,606
  • 27
  • 330
  • 524