您可以将库放在名称空间中吗? [英] Can you put a library inside a namespace?
问题描述
我正在使用OpenCV,我想将整个库放在它自己的名称空间中.我已经环顾四周了,但是没有找到答案...
I am working with OpenCV and I would like to put the entire library inside it's own namespace. I've looked around quite a bit but haven't found an answer...
您可以在不修改库源代码的情况下执行此操作吗?如果可以的话?
Can you do this without modifying the library source code? If then how?
推荐答案
基本上没有.您可以尝试通过编写包装器和宏来做到这一点,但这不太可能起作用.如果确实需要执行此操作,则更好的方法是派生该库并添加所需的名称空间.当然,采取这种方法确实需要这样做,我怀疑您没有.
Basically no. You could attempt to do it by writing wrappers and macros, but it would be unlikely to work. If you really need to do this, a better approach is to fork the library and make the needed namespace additions. Of course, you would REALLY need to do it to take this approach, and I suspect you don't.
这篇关于您可以将库放在名称空间中吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!