According to the Google Style Guides : "Few classes should be copied. Most should have neither a copy constructor nor an assignment operator."
They recommend that you make the class uncovered (that is, without pointing to the copy constructor or assignment operator) and instead recommend passing it by reference or pointer in most situations or using clone () methods that cannot be called implicitly.
However, I heard some arguments against this:
What are the positive / negative aspects of this guide? Is there a standard โrule of thumbโ to make classes inaccessible? What should be considered when creating new classes?
I have two questions with their advice:
This does not apply to modern C ++, ignoring the move / assignment operators, and therefore assumes that taking objects by value (which would have been copied earlier) is often inefficient.
. , .
, , , , . , std::unique_ptr - , , . , , . .
std::unique_ptr
, , , , , . . , , - , .
, , , - , , :
, (, , , ). , - .
++, , . /. , , , - .
, Google , , . . ++.