title: Most concise way to disable copying class in C++11
body: <p>I have a problem dealing with deprecated since C++11 default generation of copy constructor and copy assignment operator when there is a user-defined destructor.</p>
  
  <p>For most sufficiently simple classes default-generated constructors, operators and destructor are fine. Consider the following reasons to declare destructor:</p>
  
  <ol>
  <li><p>Making trivial destructor virtual in base class:</p>
  
  <pre><code>// header
  class Base1 { public: virtual ~Base1() = default; };
  class Base2 { public: virtual ~Base2(); };
  // source
  Base2::~Base2() = default;
  </code></pre>
  
  <p>Would all 4 copy and move special methods be generated by compiler in these cases? If yes, then I think it is fine and there is no need to complicate <code>Base1</code> or <code>Base2</code>.</p></li>
  <li><p>Printing debug message in destructor:</p>
  
  <pre><code>// header
  class D { public: ~D(); };
  // source
  D::~D() {
  #ifdef DEBUG_THIS
      std::cout &lt;&lt; "D was destructed." &lt;&lt; std::endl;
  #endif
  }
  </code></pre>
  
  <p>I believe that in this case copy constructor and assignment operator would be generated; but move constructor and assignment operator would not. I want to avoid using deprecated default-generating and disable copying of <code>D</code>. I also want to avoid flooding <code>D</code> with 4 <code>deleted</code> declarations. Is disabling only one copy constructor enough? Is it a good style?</p></li>
  </ol>