add iterator support
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7766 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
f1c9638b6a
commit
cda225ea32
3 changed files with 363 additions and 66 deletions
|
|
@ -36,21 +36,23 @@
|
|||
%}
|
||||
|
||||
%define %swig_set_methods(set...)
|
||||
%swig_sequence_iterator(set);
|
||||
%swig_container_methods(set);
|
||||
|
||||
%extend {
|
||||
void append(value_type x) {
|
||||
self->insert(x);
|
||||
}
|
||||
void append(value_type x) {
|
||||
self->insert(x);
|
||||
}
|
||||
|
||||
bool __contains__(value_type x) {
|
||||
return self->find(x) != self->end();
|
||||
}
|
||||
bool __contains__(value_type x) {
|
||||
return self->find(x) != self->end();
|
||||
}
|
||||
|
||||
value_type __getitem__(difference_type i) const throw (std::out_of_range) {
|
||||
return *(swig::cgetpos(self, i));
|
||||
}
|
||||
};
|
||||
value_type __getitem__(difference_type i) const throw (std::out_of_range) {
|
||||
return *(swig::cgetpos(self, i));
|
||||
}
|
||||
|
||||
};
|
||||
%enddef
|
||||
|
||||
%include <std/std_set.i>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue