Cython allows to declare a vector from the c++ standard library as public but not a queue, why is that?
# distutils: language = c++
from libcpp.vector cimport vector
from libcpp.queue cimport queue
cdef class MyClass
cdef public vector[int] var1
cdef public queue[int] var2
When trying to build an extension - setup(ext_modules = cythonize('filename.pyx', language_level='3')) - it throws these errors:
C attribute of type 'queue[int]' cannot be accessed from Python
Cannot convert 'queue[int]' to Python object
Cannot convert Python object to 'queue[int]'
But it works if public is removed. The reason it even matters is the code runs a bit faster when a variable that is used frequently and accessed from different functions in the class is declared public compared to when it isn't.
So it is strange that one class from the c++ stdlib can be public but not another, why is that?