我该如何在Cython中重载运算符 >> ?
//LIB.h
namespace LIB
{
class Point
{
friend std::istream &operator >> (std::istream &in, Point &pt)
bool operator == (const Point &pos) const
...
}
}
已经声明了一个命名空间 "LIB":
,那么我该如何处理 std:: 命名空间呢?
#LIB.pxd
cdef extern from "LIB.h" namespace "LIB":
cdef cppclass Point:
#friend std::istream &operator >> (std::istream &in, Point &pt)
bint operator == (const Point &pos) const
...
这里解释了多个cdef extern块是可能的,但我不明白它是如何工作的,因为我不能重新定义类。
LIB.h
?)中,运算符是否在命名空间LIB
中声明?这里的std::
的作用是什么?“已经声明了一个命名空间”是什么意思? - hivertstd::
命名空间。Cython 文档中的所有示例都将所有包装函数放在同一个命名空间中。 - ratiotile