I'm trying to use a map in a Cython class but the Cython compiler raises an error.
Here is an example demonstrating my problem and the error reported by Cython.
Cython file pyx
from libcpp.map cimport map
from libcpp.utility cimport pair
from libcpp.string cimport string
cdef class MyDict:
cdef:
map[string, int] components
def __setitem__(self, key, value):
self.components[key] = value
def __getitem__(self, key):
return self.components[key]
Python file
from pyximport import install
install()
from dic_class import MyDict
m = MyDict()
m["home"] = 5
print m["home"]
Error reported by Cython
fatal error: utility: No such file or directory