UTL - Fix some incorrect acceptance of types in the STL, eg a double * element passed into a vector<int *> constructor would be accepted, but the ensuing behaviour was undefined. Now the type conversion correctly raises an exception
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10958 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
0cfccf817f
commit
93f0390322
10 changed files with 75 additions and 5 deletions
29
Examples/test-suite/li_std_vector_ptr.i
Normal file
29
Examples/test-suite/li_std_vector_ptr.i
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
%module li_std_vector_ptr
|
||||
|
||||
%include "std_vector.i"
|
||||
|
||||
%template(IntPtrVector) std::vector<int *>;
|
||||
|
||||
%inline %{
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
int* makeIntPtr(int v) {
|
||||
return new int(v);
|
||||
}
|
||||
double* makeDoublePtr(double v) {
|
||||
return new double(v);
|
||||
}
|
||||
|
||||
#if 1
|
||||
int** makeIntPtrPtr(int* v) {
|
||||
return new int*(v);
|
||||
}
|
||||
#endif
|
||||
|
||||
void displayVector(std::vector<int *> vpi) {
|
||||
cout << "displayVector..." << endl;
|
||||
for (int i=0; i<vpi.size(); ++i)
|
||||
cout << *vpi[i] << endl;
|
||||
}
|
||||
%}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue