考虑这种情况:
struct Foo
{
struct Bar
{
};
};
如何转发声明Foo::Bar
?
我尝试了什么:
struct Foo::Bar;
错误:'Foo'尚未声明
struct Foo;
struct Foo::Bar;
错误:'struct Foo'中的'Bar'没有命名类型
namespace Foo
{
struct Bar;
}
// ...
struct Foo
{
struct Bar
{
};
};
错误:'struct Foo'重新声明为不同类型的符号
struct Foo
{
struct Bar;
};
// ...
struct Foo
{
struct Bar
{
};
};
错误:重新定义'struct Foo'