title: Can I use C++ class members initialized in the initializer list, later in the list?
body: <p>I am rewriting some code to eliminate global variables and made a class constructor/destructor handle cleanup of some third party library resources, but I am concerned about some code which initializes one member from another member in the class initializer list.  </p>
  
  <pre><code>class MyPodofoDocument {
  public:
      // generates pdf to stream
      MyPodofoDocument(std::stringstream *pStringStream)
          : device(pStringStream), document(&amp;device)
      {
      }
  private:
      PoDoFo::PdfOutputDevice device;
      PoDoFo::PdfStreamedDocument document;
      PoDoFo::PdfPainter painter;
  };
  </code></pre>
  
  <p>The code which uses this class doesn't need to see all the details that go into using the library, but the way I hide them makes it dependent on using members to initialize other members, before it hits the constructor's actual code block, where it has a valid this pointer.</p>
  
  <p>It works in a unit test skeleton, so my question is basically, "Is this okay, portable and safe?"</p>