Forward declaration of std::wstring

前端 未结 5 1988
忘了有多久
忘了有多久 2021-02-05 08:00
// 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         


        
5条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-05 08:07

    class std::wstring; doesn't compile. But this does:

    namespace std{
    class wstring;
    }
    

    However, this declaration is incompatible with the header file, which you should see if you #include after it. So it's really not safe.

提交回复
热议问题