context that is not a minimal reproducing example
I have a C++ function that returns a map<vector, int> and I want to convert it to python.
Obviously lists are not hashable so I convert the map to a list of pairs.
code
cdef extern from "mylib.hpp":
map[vector[bool], int] myfun()
def f():
out = []
for pair in myfun():
out.append(pair)
return out
error
error: taking address of rvalue
When looking at the generated code:
__pyx_t_3 = &myfun();
__pyx_t_2 = __pyx_t_3->begin();
for (;;) {
if (!(__pyx_t_2 != __pyx_t_3->end())) break;
__pyx_t_4 = *__pyx_t_2;
++__pyx_t_2;
__pyx_v_pair = __pyx_t_4;
fix
If I assign the map first, it works:
def f():
c_result = myfun()
out = []
for pair in c_result:
out.append(pair)
return out
context that is not a minimal reproducing example
I have a C++ function that returns a map<vector, int> and I want to convert it to python.
Obviously lists are not hashable so I convert the map to a list of pairs.
code
error
error: taking address of rvalueWhen looking at the generated code:
fix
If I assign the map first, it works: