Is it a bad or a good idea to include STL within a header file? Wherein you use them as a member variable of your own defined class.
My assumption is, there are people who really wanted their created library to be very independent on C++ standard library. So they are forced to rewrite again a type similar to the functionality available in C++ STL while other's try to forward declare in their header file the type they will be needed later. Which is other's sees this as a bad practice and not a good idea at all.
Please correct me if I'm wrong (I don't know much that's why all is just an assumption):
So what are the effects in terms of code portability (for those who really wanted their code to be platform independent) when forward declaring a type available on STL ?(I only know of a type of
vector
as suggested by MSDN can be forward declared but not guaranteed to work at all times).If I include the STL in my header file, what problem could exist? And will this affect the portability of my code?
What if I include STL in the header file of my DLL and bring that DLL in other computers, what problem could I encounter?
And, can you give me an enlightenment why I should (should not) include STL in my header?