C++ Resolving conflicts with legacy unnamed namespaces

房东的猫 提交于 2019-12-25 03:17:15

问题


I have a large body of legacy code which declares a number of important types. For example:

typedef uint32 EventId;

I'm currently integrating an excellent new version of 3rd party code (Scaleform) which has namespaces, but has conflicting definitions:

namespace Scaleform { namespace GFx {
class EventId ...
}}

There is code where both definitions are encountered, and I of course get errors:

error: reference to 'EventId' is ambiguous

note: candidate found by name lookup is 'EventId'

note: candidate found by name lookup is 'Scaleform::GFx::EventId'

(OSX Clang, BTW)

As far as I can tell, I'm kind of SOL, since C++ forbids these sorts of collisions, and I can't (for example) wrap legacy references with something like :

using namespace;

To force the unnamed namespace.

My only recourse is to rename one of the types so there's no conflict, correct?

来源:https://stackoverflow.com/questions/52434713/c-resolving-conflicts-with-legacy-unnamed-namespaces

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!