There are a couple of issues. First, you have to declare this as a c++
class not a struct (structs are for method-less C structs). You have
to enable the experimental_cpp_class_def directive to do this. Then
there's the question of how hash is defined, you might have to do
cdef extern from *:
cdef size_t hash_string "hash<string>"(string)
as Cython doesn't know about C++ template functions (yet). At this
point you might be better off defining this tiny class in an auxiliary
C++ file... (I'd like to support this, but we also want to avoid
Cython morphing into a full superset of C++. This boils down to the
general problem that C libraries are easy to use from other languages,
but C++ ones not so much.)
- Robert