C++ Class forward declaration drawbacks?

后端 未结 2 1912
半阙折子戏
半阙折子戏 2021-02-19 20:30

I want to use forward declaration of a class in my software, so I can have typedefs
and use them inside the class full declaration.

Smth like this:

         


        
2条回答
  •  南方客
    南方客 (楼主)
    2021-02-19 21:35

    From the C++ standard:

    5.3.5/5:

    "If the object being deleted has incomplete class type at the point of deletion and the complete class has a non-trivial destructor or a deallocation function, the behavior is undefined."

提交回复
热议问题