Skip to content

Instantly share code, notes, and snippets.

@ikuyamada
Created August 5, 2012 15:06
Show Gist options
  • Save ikuyamada/3265267 to your computer and use it in GitHub Desktop.
Save ikuyamada/3265267 to your computer and use it in GitHub Desktop.
Cython wrapper for std::unordered_map
from libcpp.utility cimport pair
cdef extern from "<tr1/unordered_map>" namespace "std::tr1":
cdef cppclass unordered_map[T, U]:
cppclass iterator:
pair[T, U]& operator*() nogil
iterator operator++() nogil
iterator operator--() nogil
bint operator==(iterator) nogil
bint operator!=(iterator) nogil
unordered_map()
unordered_map(unordered_map&)
U& operator[](T&) nogil
# unordered_map& operator=(unordered_map&)
U& at(T&) nogil
iterator begin() nogil
void clear() nogil
size_t count(T&) nogil
bint empty() nogil
iterator end() nogil
pair[iterator, iterator] equal_range(T&) nogil
void erase(iterator) nogil
void erase(iterator, iterator) nogil
size_t erase(T&) nogil
iterator find(T&) nogil
pair[iterator, bint] insert(pair[T, U]) nogil
iterator insert(iterator, pair[T, U]) nogil
void insert(input_iterator, input_iterator)
size_t max_size() nogil
void rehash(size_t)
size_t size() nogil
void swap(unordered_map&) nogil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment