Cython std ::对的两个指针,期望一个标识符或文字 [英] Cython std::pair of two pointers, expected an identifier or literal

查看:905
本文介绍了Cython std ::对的两个指针,期望一个标识符或文字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么在Cython中可以换行

Why in Cython is possible to wrap

std::pair<int, Foo*> myPair;

但不包括

std::pair<Foo*,Bar*> myPair;

特别是,在Cython中包装 std :: pair 如下:

In particular, wrapping in Cython the std::pair is done as follows:

pair[int, Foo*]

并且工作顺利,但是当第一个元素也是一个指针时,我有问题:

and works smoothly, but when the first element of is also a pointer I have problems:

pair[Foo*,Bar*] myPair2

获取

pair[Foo*,Bar*] myPair2
        ^
------------------------------------------------------------
test.pyx:50:17: Expected an identifier or literal

我在Linux上使用Cython 0.17.1,g ++ 4.4

I'm using Cython 0.17.1, g++ 4.4 on Linux

推荐答案

类型被视为相同对中定义< a>;它可能是 [] 语法的一般限制。您可以尝试使用typedef解决它: ctypedef Foo * Foo_pointer

The types are treated the same in the pair definition; it is probably a general limitation for the [] syntax. You could try to workaround it with a typedef: ctypedef Foo* Foo_pointer

从注释复制由@JFSebastian,以便这个问题可以标记为已回答(希望清除未回答的问题的列表 - 它已经一个月!)

这篇关于Cython std ::对的两个指针,期望一个标识符或文字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆