【发布时间】:2012-03-29 15:57:40
【问题描述】:
可能重复:
Is it a good idea to wrap an #include in a namespace block?
// Method One
#ifndef XXX_H
#define XXX_H
#include <iostream>
#include "myhead.h"
namespace XXX
{
/...
}
#endif
OR
// Method Two
namespace XXX
{
#ifndef XXX_H
#define XXX_H
#include <iostream>
#include "myhead.h"
/...
#endif
}
当我们定义一个新的namespace XXX 时,我们是否应该将#include directive 移动到命名空间内?
谢谢
【问题讨论】:
标签: c++