Christian Staudt Christian Staudt - 11 months ago 120
Python Question

Are C++11 containers supported by Cython?

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

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

Answer Source

Cython doesn't support them by default, but you could probably create your own interface, following the structure of

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