Note that it is generally safer to only use forward declarations for your own code. By using forward declarations, you are embedding knowledge of how symbols are declared in the header that you are eliding. For example, if you use forward declares for a foreign header and your API is used in environments with different versions of that header, the declaration of a class within that header could be changed to a typedef or the class could be changed to a templated class, which would break your forward declaration. This is one reason why you should specifically never try to forward declare STL objects, for example, always do #include <string>, never attempt to forward declare ...
There are different implementation of std library so that when your forward declare, your code may work differently based on the std library that you link with. Especially, the library you're linking with happens to have same type defined as template type. Even if you intend to use them as template type, if someone applies different type for the template type, the behaviour of your code can change or not work at all.
Share this highlighthttp://www.safaribooksonline.com/a/api-design-for/14817775/