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.
If I understood it correctly, I need to write like the following.
// stl.hpp
#include <string>
#include <algorithm>
#include <vector>
Now include stl.hpp
in all the files that needs access to STL. Is this correct?
Few of my files will be using only functionality from vector
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?
Any help would be great!