Remove conversion from one STL container to another
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10214 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
c7ec8c691d
commit
cb9d191276
4 changed files with 42 additions and 8 deletions
|
|
@ -1,5 +1,8 @@
|
|||
%module li_std_vector
|
||||
|
||||
%warnfilter(509) overloaded1;
|
||||
%warnfilter(509) overloaded2;
|
||||
|
||||
%include "std_string.i"
|
||||
%include "std_vector.i"
|
||||
%include "cpointer.i"
|
||||
|
|
@ -126,3 +129,11 @@ std::vector<std::string> vecStr(std::vector<std::string> v) {
|
|||
namespace std {
|
||||
%template(ConstIntVector) vector<const int *>;
|
||||
}
|
||||
|
||||
%inline %{
|
||||
std::string overloaded1(std::vector<double> vi) { return "vector<double>"; }
|
||||
std::string overloaded1(std::vector<int> vi) { return "vector<int>"; }
|
||||
std::string overloaded2(std::vector<int> vi) { return "vector<int>"; }
|
||||
std::string overloaded2(std::vector<double> vi) { return "vector<double>"; }
|
||||
%}
|
||||
|
||||
|
|
|
|||
|
|
@ -111,3 +111,16 @@ iv[1:3] = []
|
|||
if iv[1] != 3:
|
||||
raise RuntimeError
|
||||
|
||||
# Overloading checks
|
||||
if overloaded1(iv) != "vector<int>":
|
||||
raise RuntimeError
|
||||
|
||||
if overloaded1(dv) != "vector<double>":
|
||||
raise RuntimeError
|
||||
|
||||
if overloaded2(iv) != "vector<int>":
|
||||
raise RuntimeError
|
||||
|
||||
if overloaded2(dv) != "vector<double>":
|
||||
raise RuntimeError
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue