title: Is the PIMPL idiom really used in practice?
body: <p>I am reading the book <em>&quot;Exceptional C++&quot;</em> by Herb Sutter, and in that book I have learned about the PIMPL idiom. Basically, the idea is to create a structure for the <code>private</code> objects of a <code>class</code> and dynamically allocate them to <strong>decrease the compilation time</strong> (and also hide the private implementations in a better manner).</p>
  <p>For example:</p>
  <pre><code>class X
  {
  private:
    C c;
    D d;
  } ;
  </code></pre>
  <p>could be changed to:</p>
  <pre><code>class X
  {
  private:
    struct XImpl;
    XImpl* pImpl;
  };
  </code></pre>
  <p>and, in the .cpp file, the definition:</p>
  <pre><code>struct X::XImpl
  {
    C c;
    D d;
  };
  </code></pre>
  <p>This seems pretty interesting, but I have never seen this kind of approach before, neither in the companies I have worked, nor in open source projects that I've seen the source code. So, I am wondering whether this technique is really used in practice.</p>
  <p>Should I use it everywhere, or with caution? And is this technique recommended to be used in embedded systems (where the performance is very important)?</p>