Fixed some errors in the template specialization for std_vector.i on
vectors of "pointer to T". git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5311 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
9b25a498ab
commit
db6a5a9f0b
1 changed files with 4 additions and 4 deletions
|
|
@ -314,7 +314,7 @@ namespace std {
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
vector(unsigned int size = 0);
|
vector(unsigned int size = 0);
|
||||||
vector(unsigned int size, const T* value);
|
vector(unsigned int size, T * &value);
|
||||||
vector(const vector<T*> &);
|
vector(const vector<T*> &);
|
||||||
|
|
||||||
%rename(__len__) size;
|
%rename(__len__) size;
|
||||||
|
|
@ -323,7 +323,7 @@ namespace std {
|
||||||
bool empty() const;
|
bool empty() const;
|
||||||
void clear();
|
void clear();
|
||||||
%rename(push) push_back;
|
%rename(push) push_back;
|
||||||
void push_back(const T* x);
|
void push_back(T* x);
|
||||||
%extend {
|
%extend {
|
||||||
T* pop() {
|
T* pop() {
|
||||||
if (self->size() == 0)
|
if (self->size() == 0)
|
||||||
|
|
@ -340,7 +340,7 @@ namespace std {
|
||||||
else
|
else
|
||||||
throw std::out_of_range("vector index out of range");
|
throw std::out_of_range("vector index out of range");
|
||||||
}
|
}
|
||||||
void __setitem__(int i, const T* x) {
|
void __setitem__(int i, T* x) {
|
||||||
int size = int(self->size());
|
int size = int(self->size());
|
||||||
if (i<0) i+= size;
|
if (i<0) i+= size;
|
||||||
if (i>=0 && i<size)
|
if (i>=0 && i<size)
|
||||||
|
|
@ -350,7 +350,7 @@ namespace std {
|
||||||
}
|
}
|
||||||
void each() {
|
void each() {
|
||||||
for (unsigned int i=0; i<self->size(); i++) {
|
for (unsigned int i=0; i<self->size(); i++) {
|
||||||
T* x = &((*self)[i]);
|
T* x = (*self)[i];
|
||||||
rb_yield(SWIG_NewPointerObj((void *) x,
|
rb_yield(SWIG_NewPointerObj((void *) x,
|
||||||
$descriptor(T *), 0));
|
$descriptor(T *), 0));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue