[PHP] "empty" is a reserved word in PHP, so rename empty() method
on STL classes to "is_empty()" (previously this was automatically renamed to "c_empty()"). *** POTENTIAL INCOMPATIBILITY *** git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11772 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
8461ba43ff
commit
0633acd24f
3 changed files with 35 additions and 16 deletions
|
|
@ -27,7 +27,7 @@
|
|||
};
|
||||
*/
|
||||
|
||||
%define %std_deque_methods(T)
|
||||
%define %std_deque_methods_noempty(T)
|
||||
typedef T &reference;
|
||||
typedef const T& const_reference;
|
||||
|
||||
|
|
@ -41,7 +41,6 @@
|
|||
unsigned int size() const;
|
||||
unsigned int max_size() const;
|
||||
void resize(unsigned int n, T c = T());
|
||||
bool empty() const;
|
||||
const_reference front();
|
||||
const_reference back();
|
||||
void push_front(const T& x);
|
||||
|
|
@ -69,7 +68,7 @@
|
|||
throw std::out_of_range("deque index out of range");
|
||||
}
|
||||
void delitem(int i) throw (std::out_of_range) {
|
||||
int size = int(self->size());
|
||||
int size = int(self->size());
|
||||
if (i<0) i+= size;
|
||||
if (i>=0 && i<size) {
|
||||
self->erase(self->begin()+i);
|
||||
|
|
@ -77,7 +76,7 @@
|
|||
throw std::out_of_range("deque index out of range");
|
||||
}
|
||||
}
|
||||
std::deque<T> getslice(int i, int j) {
|
||||
std::deque<T> getslice(int i, int j) {
|
||||
int size = int(self->size());
|
||||
if (i<0) i = size+i;
|
||||
if (j<0) j = size+j;
|
||||
|
|
@ -112,15 +111,25 @@
|
|||
self->erase(self->begin()+i,self->begin()+j);
|
||||
}
|
||||
};
|
||||
|
||||
%enddef
|
||||
|
||||
#ifdef SWIGPHP
|
||||
%define %std_deque_methods(T)
|
||||
%extend {
|
||||
bool is_empty() const {
|
||||
return self->empty();
|
||||
}
|
||||
};
|
||||
%enddef
|
||||
#else
|
||||
%define %std_deque_methods(T)
|
||||
bool empty() const;
|
||||
%enddef
|
||||
#endif
|
||||
|
||||
namespace std {
|
||||
template<class T> class deque {
|
||||
public:
|
||||
%std_deque_methods(T);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue