Forward declaration of objects with STL containers

前端 未结 3 802

Consider the following code snippet, where the first line serves only as forward declaration

 class A;

followed by defining new class

3条回答
  •  旧巷少年郎
    2020-12-19 07:53

    Nope, this behavior is expected and standard.

    The rational is that std::pair actually forms a struct, therefore both its types must be complete before instantiation.

提交回复
热议问题