Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试获取对 cython 中对象的引用。以下代码编译没有问题:
cdef vector[int] a a.push_back(1) cdef vector[int] & b=a
但是,当我添加以下行时:
b.push_back(1)
编译器抱怨 b 已被声明为引用但未初始化。我应该如何在 cython 中初始化引用?(文档对 cython 中引用的使用有点模糊)
为什么不这样做:
cdef vector[int] a a.push_back(1) cdef vector[int] *b=&a b[0].push_back(1) b.push_back(2) # Works too, I gess