Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/358.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/100.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法在cython中修改集合 我想在C++中删除一组未签名的int,并在Python中修改它: %load\u ext Cython %加载外部cythonmagic %%赛昂 第二语言:语言= C++ 从libcpp.set cimport set为cpp_set 从cython.operator cimport将解引用作为解引用 def修改测试数据(): cdef(cpp_集[int])*s=新的cpp_集[int]() 打印日期、类型(日期) 删除。添加(1) 打印日期(s) 修改测试数据()_Python_C++_Set_Cython - Fatal编程技术网

无法在cython中修改集合 我想在C++中删除一组未签名的int,并在Python中修改它: %load\u ext Cython %加载外部cythonmagic %%赛昂 第二语言:语言= C++ 从libcpp.set cimport set为cpp_set 从cython.operator cimport将解引用作为解引用 def修改测试数据(): cdef(cpp_集[int])*s=新的cpp_集[int]() 打印日期、类型(日期) 删除。添加(1) 打印日期(s) 修改测试数据()

无法在cython中修改集合 我想在C++中删除一组未签名的int,并在Python中修改它: %load\u ext Cython %加载外部cythonmagic %%赛昂 第二语言:语言= C++ 从libcpp.set cimport set为cpp_set 从cython.operator cimport将解引用作为解引用 def修改测试数据(): cdef(cpp_集[int])*s=新的cpp_集[int]() 打印日期、类型(日期) 删除。添加(1) 打印日期(s) 修改测试数据(),python,c++,set,cython,Python,C++,Set,Cython,输出: set([]) set([])#在这里,我希望是“set([1])” 我不确定我是否需要deref的东西,但是没有它,类型就不匹配了。有人能解释一下我是如何做到这一点的吗?AFAICT,你把Python的set和C++混为一谈了。后者的方法是插入,而不是添加(与前者一样) 如果将相关行更改为: deref(s).insert(1) 输出变为: set([]) <type 'set'> set([1]) set([]) 集合([1]) Hm,很简单:)谢谢!

输出:

set([])
set([])#在这里,我希望是“set([1])”

我不确定我是否需要deref的东西,但是没有它,类型就不匹配了。有人能解释一下我是如何做到这一点的吗?

AFAICT,你把Python的
set
和C++混为一谈了。后者的方法是
插入
,而不是
添加
(与前者一样)

如果将相关行更改为:

deref(s).insert(1)
输出变为:

set([]) <type 'set'>
set([1])
set([])
集合([1])
Hm,很简单:)谢谢!