如何处理大量“使用”声明?
C++ 中是否有处理大量 using 语句的礼仪?例如,如果我有一个包含以下内容的头文件:
using std::vector;
using std::string;
...
using std::map;
...
其中 ... 表示 using 语句的进一步扩展。我想要一种减少“混乱”的方法。或者拥有大量 using 语句只是不好的做法?
Is there an etiquette for dealing with a large number of using statements in C++? For example if I have a header file with the following:
using std::vector;
using std::string;
...
using std::map;
...
where ... indicate further extensions of using statement. I would like a way to reduce 'clutter'. Or is it just bad practice to have a large number of using statements?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
处理它们的一种方法是不在命名空间范围内使用它们。您可以使用这样的限定名称,例如:
One way to handle them is to not use them in namespace scope. You can use qualified names like this for example: