Allow objects to be modified during iteration (and minor method name change)

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4246 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Luigi Ballabio 2003-01-29 13:05:45 +00:00
commit 7a8f71fa7c

View file

@ -175,7 +175,6 @@ namespace std {
unsigned int size() const; unsigned int size() const;
%rename("empty?") empty; %rename("empty?") empty;
bool empty() const; bool empty() const;
%rename("clear!") clear;
void clear(); void clear();
%rename(push) push_back; %rename(push) push_back;
void push_back(const T& x); void push_back(const T& x);
@ -206,8 +205,8 @@ namespace std {
void each() { void each() {
swig_type_info* type = SWIG_TypeQuery(#T " *"); swig_type_info* type = SWIG_TypeQuery(#T " *");
for (unsigned int i=0; i<self->size(); i++) { for (unsigned int i=0; i<self->size(); i++) {
T* x = new T((*self)[i]); T* x = &((*self)[i]);
rb_yield(SWIG_NewPointerObj((void *) x, type, 1)); rb_yield(SWIG_NewPointerObj((void *) x, type, 0));
} }
} }
} }
@ -322,7 +321,6 @@ namespace std {
unsigned int size() const; unsigned int size() const;
%rename("empty?") empty; %rename("empty?") empty;
bool empty() const; bool empty() const;
%rename("clear!") clear;
void clear(); void clear();
%rename(push) push_back; %rename(push) push_back;
void push_back(T x); void push_back(T x);