Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix for iterator #58

Merged
merged 1 commit into from
Apr 29, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions genapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,35 +378,35 @@ def convert_to_cpp(self, x, t):
'std::set': (
'{valdecl}\n'
'cdef {valtype} {valname}\n'
'cdef std_set[{valtype}].iterator it\n'
'cdef std_set[{valtype}].iterator it{var}\n'
'cdef set py{var}\n',
'py{var} = set()\n'
'it = {var}.begin()\n'
'while it != {var}.end():\n'
' {valname} = deref(it)\n'
'it{var} = {var}.begin()\n'
'while it{var} != {var}.end():\n'
' {valname} = deref(it{var})\n'
' {valbody.indent4}\n'
' pyval = {valexpr}\n'
' py{var}.add(pyval)\n'
' inc(it)\n',
' inc(it{var})\n',
'py{var}'),
'std::map': (
'{keydecl}\n'
'{valdecl}\n'
'cdef {keytype} {keyname}\n'
'cdef {valtype} {valname}\n'
'cdef {type}.iterator it\n'
'cdef {type}.iterator it{var}\n'
'cdef dict py{var}\n',
'py{var} = {{}}\n'
'it = {var}.begin()\n'
'while it != {var}.end():\n'
' {keyname} = deref(it).first\n'
'it{var} = {var}.begin()\n'
'while it{var} != {var}.end():\n'
' {keyname} = deref(it{var}).first\n'
' {keybody.indent4}\n'
' pykey = {keyexpr}\n'
' {valname} = deref(it).second\n'
' {valname} = deref(it{var}).second\n'
' {valbody.indent4}\n'
' pyval = {valexpr}\n'
' py{var}[pykey] = pyval\n'
' inc(it)\n',
' inc(it{var})\n',
'py{var}'),
'std::pair': (
'{firstdecl}\n'
Expand All @@ -423,16 +423,16 @@ def convert_to_cpp(self, x, t):
'std::list': (
'{valdecl}\n'
'cdef {valtype} {valname}\n'
'cdef std_list[{valtype}].iterator it\n'
'cdef std_list[{valtype}].iterator it{var}\n'
'cdef list py{var}\n',
'py{var} = []\n'
'it = {var}.begin()\n'
'while it != {var}.end():\n'
' {valname} = deref(it)\n'
'it{var} = {var}.begin()\n'
'while it{var} != {var}.end():\n'
' {valname} = deref(it{var})\n'
' {valbody.indent4}\n'
' pyval = {valexpr}\n'
' py{var}.append(pyval)\n'
' inc(it)\n',
' inc(it{var})\n',
'py{var}'),
'std::vector': (
'cdef np.npy_intp {var}_shape[1]\n',
Expand Down