xdress/xdress — pull request #217 by gidden (2014-04-07 01:14:01+00:00)
Title: Pair

Hi @scopatz, would you be a peach and help me with some issues in this pair PR? I'm getting passing tests, but my cyclopts branch fails. I'm going to continue investigating on my own, but I thought I'd start pinging you now.
```
Error compiling Cython file:
------------------------------------------------------------
...
if not isinstance(key, int):
return False

k = key

if 0 < self.pair_ptr.count(k):
^
------------------------------------------------------------

/home/gidden/phd/cyclopts/cyclopts/stlcontainers.pyx:106:19: Cannot convert 'pair[int,double] *' to Python object

Error compiling Cython file:
------------------------------------------------------------
...
return True
else:
return False

def __len__(self):
return self.pair_ptr.size()
^
------------------------------------------------------------

/home/gidden/phd/cyclopts/cyclopts/stlcontainers.pyx:112:19: Cannot convert 'pair[int,double] *' to Python object

Error compiling Cython file:
------------------------------------------------------------
...
if not isinstance(key, int):
raise TypeError("Only integer keys are valid.")

k = key

if 0 < self.pair_ptr.count(k):
^
------------------------------------------------------------

/home/gidden/phd/cyclopts/cyclopts/stlcontainers.pyx:124:19: Cannot convert 'pair[int,double] *' to Python object

Error compiling Cython file:
------------------------------------------------------------
...
raise TypeError("Only integer keys are valid.")

k = key

if 0 < self.pair_ptr.count(k):
v = deref(self.pair_ptr)[k]
^
------------------------------------------------------------

/home/gidden/phd/cyclopts/cyclopts/stlcontainers.pyx:125:36: Indexing 'pair[int,double]' not supported for index type 'int'

Error compiling Cython file:
------------------------------------------------------------
...
k = key

if 0 < self.pair_ptr.count(k):
v = deref(self.pair_ptr)[k]

return float(deref(self.pair_ptr)[k])
^
------------------------------------------------------------

/home/gidden/phd/cyclopts/cyclopts/stlcontainers.pyx:127:45: Indexing 'pair[int,double]' not supported for index type 'int'

Error compiling Cython file:
------------------------------------------------------------
...

cdef pair[int, double] item

item = pair[int, double]( key, value)
if 0 < self.pair_ptr.count( key):
^
------------------------------------------------------------

/home/gidden/phd/cyclopts/cyclopts/stlcontainers.pyx:138:19: Cannot convert 'pair[int,double] *' to Python object

Error compiling Cython file:
------------------------------------------------------------
...
cdef pair[int, double] item

item = pair[int, double]( key, value)
if 0 < self.pair_ptr.count( key):
self.pair_ptr.erase( key)
^
------------------------------------------------------------

/home/gidden/phd/cyclopts/cyclopts/stlcontainers.pyx:139:16: Cannot convert 'pair[int,double] *' to Python object

Error compiling Cython file:
------------------------------------------------------------
...

item = pair[int, double]( key, value)
if 0 < self.pair_ptr.count( key):
self.pair_ptr.erase( key)
self.pair_ptr.insert(item)
^
------------------------------------------------------------

/home/gidden/phd/cyclopts/cyclopts/stlcontainers.pyx:140:12: Cannot convert 'pair[int,double] *' to Python object

Error compiling Cython file:
------------------------------------------------------------
...
cdef int k

if key in self:

k = key
self.pair_ptr.erase(k)
^
------------------------------------------------------------
```