title: When should you make a class uncopyable?
body: <p>According to the <a href="https://google.github.io/styleguide/cppguide.html" rel="nofollow noreferrer">Google style guidelines</a>, &quot;Few classes need to be copyable. Most should have neither a copy constructor nor an assignment operator.&quot;</p>
  <p>They recommend you make a class uncopyable (that is, not giving it a copy constructor or assignment operator), and instead recommending passing by reference or pointer in most situations, or using clone() methods which cannot be invoked implicitly.</p>
  <p>However, I've heard some arguments against this:</p>
  <ul>
  <li>Accessing a reference is (usually) slower than accessing a value.</li>
  <li>In some computations, I might want to leave the original object the way it is and just return the changed object.</li>
  <li>I might want to store the value of a computation as a local object in a function and return it, which I couldn't do if I returned it by reference.</li>
  <li>If a class is small enough, passing by reference is slower.</li>
  </ul>
  <p>What are the positives/negatives of following this guideline? Is there any standard &quot;rule of thumb&quot; for making classes uncopyable? What should I consider when creating new classes?</p>