任何对模棱两可的引用的优雅解决方案

Any elegant solution to ambiguous references?

本文关键字:解决方案 引用 模棱两可 任何      更新时间:2023-10-16

我的代码中出现了很多不明确的引用。我必须删除"使用命名空间x"代码,并将每个"something"更改为"x::something。。。有什么捷径或优雅的解决方案吗?

是的,我知道,我不会再使用"使用名称空间"了:)

您可以这样做:

而不是使用:

using namespace std; // all std 

你可以专门消除歧义:

using std::cout, std::cin, std::endl; // specific references from std