我在下面的代码中有一个问题 .
#define V8_DECLARE_ONCE(NAME) ::v8::base::OnceType NAME
在cpp文件中,'::'表示引用命名空间,但包含':: v8'的地方?
std::cout << ... << std::endl;
cout在'std'命名空间下,但是,在这种情况下,我不知道如何解释它 .
此代码的一部分是遵循一个 .
namespace v8 {
namespace base {
typedef AtomicWord OnceType;
#define V8_ONCE_INIT 0
#define V8_DECLARE_ONCE(NAME) ::v8::base::OnceType NAME
1 回答
::ns
表示查找ns
的根命名空间 . 它's to avoid possible namespace collisions, since it avoids looking in the current namespace, if you define your own namespace and it has the same name. Here'是一个证明差异的例子 .打印
5, 10
.