Cython支持C ++ 11容器吗? [英] Are C++11 containers supported by Cython?

查看:482
本文介绍了Cython支持C ++ 11容器吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Cython为我们提供了一种导入C ++标准库数据结构的简单方法,例如:

Cython gives us an easy way to import C++ standard library data structures, e.g.:

  from libcpp.vector cimport vector
    from libcpp.utility cimport pair



< std :: unordered_map std :: unordered_set 等是否以相同的方式支持?我找不到合适的导入语句。

But what about newer containers introduced with C++11: std::unordered_map, std::unordered_set etc. Are they supported in the same way? I could not find the appropriate import statement.

推荐答案

Cython默认不支持它们,创建自己的界面,遵循 https://的结构github.com/cython/cython/blob/master/Cython/Includes/libcpp/map.pxd

Cython现在支持unordered_map和unordered_set,因为 0.20.2 。 / p>

Cython now supported unordered_map and unordered_set since 0.20.2.

from libcpp.unordered_map cimport unordered_map
from libcpp.unordered_set cimport unordered_set

这篇关于Cython支持C ++ 11容器吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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