我使用过的大多数 C++ 编译器都接受以下内容
#include <map>
struct A;
struct B
{
typedef std::map<int,A>::iterator iterator;
std::map<int,A> test;
};
struct A
{
};
int main()
{
return 0;
}
但是,Apple clang 4.0 编译时使用
clang++ test.cpp -o test -std=c++11 -stdlib=libc++
产生一组错误,暗示 A 在 std::map 可以使用之前必须是一个完整的类型。这是 map 的 libc++ 实现中的缺陷、C++11 强加的新要求还是我的错误假设?