更新时间:2022-11-16 11:05:43
这与性能完全无关.但请考虑一下:您正在使用两个名为 Foo 和 Bar 的库:
This is not related to performance at all. But consider this: you are using two libraries called Foo and Bar:
using namespace foo;
using namespace bar;
一切正常,您可以毫无问题地从 Foo 调用 Blah()
和从 Bar 调用 Quux()
.但是有一天你升级到新版本的 Foo 2.0,它现在提供了一个名为 Quux()
的函数.现在您遇到了冲突:Foo 2.0 和 Bar 都将 Quux()
导入到您的全局命名空间中.这将需要一些努力来修复,尤其是在函数参数碰巧匹配的情况下.
Everything works fine, and you can call Blah()
from Foo and Quux()
from Bar without problems. But one day you upgrade to a new version of Foo 2.0, which now offers a function called Quux()
. Now you've got a conflict: Both Foo 2.0 and Bar import Quux()
into your global namespace. This is going to take some effort to fix, especially if the function parameters happen to match.
如果你用过foo::Blah()
和bar::Quux()
,那么foo::Quux()
的介绍代码>将是一个非事件.
If you had used foo::Blah()
and bar::Quux()
, then the introduction of foo::Quux()
would have been a non-event.