use of “struct Foo” in field decl doesn't forward declare nested class
问题 I am apparently misunderstanding how the C-ish feature of simultaneously "declaring" and referring to a type using struct X works in C++. (Plus I don't even know what this feature is called, properly.) I have three examples below to show what I'm doing but the main question is: Why is the nested type, forward declared in this way, at global scope instead of in class scope? This works to forward declare a nested struct: #include <memory> class Foo1 { Foo1(); ~Foo1(); struct Impl; std::auto_ptr