Commit f77650eb authored by Robert Bradshaw's avatar Robert Bradshaw

Working stl vector example.

parent 2fe3ae06
......@@ -393,7 +393,6 @@ class Scope(object):
entry.type.scope = scope
self.type_entries.append(entry)
if not scope and not entry.type.scope:
print pos
self.check_for_illegal_incomplete_ctypedef(typedef_flag, pos)
return entry
......
__doc__ = u"""
>>> test_vector([1,10,100])
1
10
100
"""
cdef extern from "vector" namespace std:
cdef cppclass iterator[T]:
pass
cdef cppclass vector[T]:
#constructors
__init__()
T at(int)
void push_back(T t)
void assign(int, T)
void clear()
iterator end()
iterator begin()
int size()
def test_vector(L):
cdef vector[int] *V = new vector[int]()
for a in L:
V.push_back(a)
cdef int i
for i in range(len(L)):
print V.at(i)
del V
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment