add set __getitem__ method, this allows python iterator syntax to work, as in 'for i in a_set:...'
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7338 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
43bdb55a63
commit
877535badf
2 changed files with 14 additions and 0 deletions
|
|
@ -46,6 +46,10 @@
|
|||
bool __contains__(value_type x) {
|
||||
return self->find(x) != self->end();
|
||||
}
|
||||
|
||||
value_type __getitem__(difference_type i) const {
|
||||
return *(swig::cgetpos(self, i));
|
||||
}
|
||||
};
|
||||
%enddef
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue