c++中::xxx含义
看代码对::std
的写法不理解,经查含义是解除当前namespace从顶端调用。
举例:
namespace A
{
B::D d1;
//d1类型为A::B::D
::C::D d2;
//d2类型C::D
}
原文:
using A::foo; resolves A from the current scope, while using ::A::foo searches for A from the root namespace.
看代码对::std
的写法不理解,经查含义是解除当前namespace从顶端调用。
举例:
namespace A
{
B::D d1;
//d1类型为A::B::D
::C::D d2;
//d2类型C::D
}
原文:
using A::foo; resolves A from the current scope, while using ::A::foo searches for A from the root namespace.
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步