// This is a header file.
class MyClass; // It can be forward declared because the function uses reference.
// However, how can I do forward declaraion about std::wstri
You can't forward declare std::wstring
in a conforming implementation, not because it is a typedef
for a template
specialization or that there is any possibility that it has an unknown number of template arguments (it doesn't; these are strictly specified) but because there is a constraint on conforming programs that prohibits them from adding any declarations or definitions to the std
namespace other than explicit specializations of standard templates which are specialized on a user-defined type.
This constraint is stated in 17.4.3.1 [lib.reserved.names] / 1. There is no exception for forward declarations of std::wstring
, you must #include
to make a declaration std::wstring
available in a conforming way.