我有两个版本的operator<<
位于不同的命名空间中,它们具有相同的签名。由于swig
将它们压缩到一个单独的名称空间中,它们彼此冲突,使我无法运行接口。在
我不需要使用脚本语言(Python)中的流插入运算符, 有没有办法抑制这些。在
%ignore
指令似乎没有帮助。在
最小测试设置
头文件
//file:test.h
#include <iostream>
#include <boost/numeric/ublas/vector.hpp>
namespace probabilities{
typedef boost::numeric::ublas::vector< double > UnivariateTable;
inline
std::ostream& operator<<( std::ostream& ostr, const UnivariateTable& table){
ostr<<"I am a table";
return ostr;
}
}
namespace positions{
typedef boost::numeric::ublas::vector< double > PositionVector;
inline
std::ostream& operator<<(std::ostream& ostr, const PositionVector& vect){
ostr<<"I am a vector";
return ostr;
}
}
Swig接口文件
^{pr2}$结果
[dmcnamara]$ swig -c++ -python -I/opt/vista_deps/include -I/opt/vista/include test.i
test.h:26: Error: '__lshift__' is multiply defined in the generated target language module in scope .
test.h:15: Error: Previous declaration of '__lshift__'
在写作过程中,我意识到:
您需要为
%ignore
指令指定名称空间:也可以使用预处理工具:
相关问题 更多 >
编程相关推荐