给定A.h下面的文件(请注意,我故意没有<iostream>在此文件中包含标题)。VS2010 文本编辑器随后会在下方显示一条红线std,因为它无法识别此名称。
class A
{
public;
A() throw(std::bad_alloc);
};
但是,如果我<iostream>在文件中包含以下标题A.cpp,则红线会在A.h文件中消失,即使A.cpp关闭了也是如此。这怎么可能 ?
#include <iostream>
#include "A.h"
A::A() { throw std::bad_alloc(); }