*** empty log message ***
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4656 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
959114d678
commit
5e6db51008
1 changed files with 9 additions and 9 deletions
|
|
@ -83,13 +83,13 @@ namespace std {
|
||||||
unsigned int size = (PyTuple_Check($input) ?
|
unsigned int size = (PyTuple_Check($input) ?
|
||||||
PyTuple_Size($input) :
|
PyTuple_Size($input) :
|
||||||
PyList_Size($input));
|
PyList_Size($input));
|
||||||
$1 = std::vector<T >(size);
|
$1.reserve(size);
|
||||||
for (unsigned int i=0; i<size; i++) {
|
for (unsigned int i=0; i<size; i++) {
|
||||||
T* x;
|
T* x;
|
||||||
PyObject* o = PySequence_GetItem($input,i);
|
PyObject* o = PySequence_GetItem($input,i);
|
||||||
if ((SWIG_ConvertPtr(o,(void **) &x,
|
if ((SWIG_ConvertPtr(o,(void **) &x,
|
||||||
$descriptor(T *),0)) != -1) {
|
$descriptor(T *),0)) != -1) {
|
||||||
(($1_type &)$1)[i] = *x;
|
(($1_type &)$1).push_back(*x);
|
||||||
Py_DECREF(o);
|
Py_DECREF(o);
|
||||||
} else {
|
} else {
|
||||||
Py_DECREF(o);
|
Py_DECREF(o);
|
||||||
|
|
@ -111,13 +111,13 @@ namespace std {
|
||||||
unsigned int size = (PyTuple_Check($input) ?
|
unsigned int size = (PyTuple_Check($input) ?
|
||||||
PyTuple_Size($input) :
|
PyTuple_Size($input) :
|
||||||
PyList_Size($input));
|
PyList_Size($input));
|
||||||
$result = std::vector<T >(size);
|
$result.reserve(size);
|
||||||
for (unsigned int i=0; i<size; i++) {
|
for (unsigned int i=0; i<size; i++) {
|
||||||
T* x;
|
T* x;
|
||||||
PyObject* o = PySequence_GetItem($input,i);
|
PyObject* o = PySequence_GetItem($input,i);
|
||||||
if ((SWIG_ConvertPtr(o,(void **) &x,
|
if ((SWIG_ConvertPtr(o,(void **) &x,
|
||||||
$descriptor(T *),0)) != -1) {
|
$descriptor(T *),0)) != -1) {
|
||||||
(($type &)$result)[i] = *x;
|
(($type &)$result).push_back(*x);
|
||||||
Py_DECREF(o);
|
Py_DECREF(o);
|
||||||
} else {
|
} else {
|
||||||
Py_DECREF(o);
|
Py_DECREF(o);
|
||||||
|
|
@ -140,14 +140,14 @@ namespace std {
|
||||||
unsigned int size = (PyTuple_Check($input) ?
|
unsigned int size = (PyTuple_Check($input) ?
|
||||||
PyTuple_Size($input) :
|
PyTuple_Size($input) :
|
||||||
PyList_Size($input));
|
PyList_Size($input));
|
||||||
temp = std::vector<T >(size);
|
temp.reserve(size);
|
||||||
$1 = &temp;
|
$1 = &temp;
|
||||||
for (unsigned int i=0; i<size; i++) {
|
for (unsigned int i=0; i<size; i++) {
|
||||||
T* x;
|
T* x;
|
||||||
PyObject* o = PySequence_GetItem($input,i);
|
PyObject* o = PySequence_GetItem($input,i);
|
||||||
if ((SWIG_ConvertPtr(o,(void **) &x,
|
if ((SWIG_ConvertPtr(o,(void **) &x,
|
||||||
$descriptor(T *),0)) != -1) {
|
$descriptor(T *),0)) != -1) {
|
||||||
temp[i] = *x;
|
temp.push_back(*x);
|
||||||
Py_DECREF(o);
|
Py_DECREF(o);
|
||||||
} else {
|
} else {
|
||||||
Py_DECREF(o);
|
Py_DECREF(o);
|
||||||
|
|
@ -172,14 +172,14 @@ namespace std {
|
||||||
unsigned int size = (PyTuple_Check($input) ?
|
unsigned int size = (PyTuple_Check($input) ?
|
||||||
PyTuple_Size($input) :
|
PyTuple_Size($input) :
|
||||||
PyList_Size($input));
|
PyList_Size($input));
|
||||||
temp = std::vector<T >(size);
|
temp.reserve(size);
|
||||||
$result = &temp;
|
$result = &temp;
|
||||||
for (unsigned int i=0; i<size; i++) {
|
for (unsigned int i=0; i<size; i++) {
|
||||||
T* x;
|
T* x;
|
||||||
PyObject* o = PySequence_GetItem($input,i);
|
PyObject* o = PySequence_GetItem($input,i);
|
||||||
if ((SWIG_ConvertPtr(o,(void **) &x,
|
if ((SWIG_ConvertPtr(o,(void **) &x,
|
||||||
$descriptor(T *),0)) != -1) {
|
$descriptor(T *),0)) != -1) {
|
||||||
temp[i] = *x;
|
temp.push_back(*x);
|
||||||
Py_DECREF(o);
|
Py_DECREF(o);
|
||||||
} else {
|
} else {
|
||||||
Py_DECREF(o);
|
Py_DECREF(o);
|
||||||
|
|
@ -190,7 +190,7 @@ namespace std {
|
||||||
$descriptor,1) != -1){
|
$descriptor,1) != -1){
|
||||||
$result = v;
|
$result = v;
|
||||||
} else {
|
} else {
|
||||||
throw SWIG_DIRECTOR_TYPE_MISMATCH("vector<" #T "> expected");
|
throw SWIG_DIRECTOR_TYPE_MISMATCH("vector<" #T "> expected");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
%typemap(out) vector<T> {
|
%typemap(out) vector<T> {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue