title: Precompiling standard library header files - C++
body: <p>In my project several STL headers are used in different files. I read that, putting all these headers into a single header and using that header in my files will allow compilers to precompile the header which may lead into faster compile time. </p>
  
  <p>If I understood it correctly, I need to write like the following.</p>
  
  <pre><code>// stl.hpp
  #include &lt;string&gt;
  #include &lt;algorithm&gt;
  #include &lt;vector&gt;
  </code></pre>
  
  <p>Now include <code>stl.hpp</code> in all the files that needs access to STL. Is this correct?</p>
  
  <p>Few of my files will be using only functionality from <code>vector</code> header file. But if I follow the above method, it will include unnecessary headers. Will this make any problem? Is there any code generated if I include a header file and not used anything from that?</p>
  
  <p>Any help would be great!</p>