add ptr cases
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5819 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
1cca8352ef
commit
ffd76a5b4e
4 changed files with 42 additions and 2 deletions
|
|
@ -34,6 +34,14 @@ namespace std {
|
||||||
|
|
||||||
%template(ABPair) pair<A, B>;
|
%template(ABPair) pair<A, B>;
|
||||||
%template(IntAPair) pair<int, A>;
|
%template(IntAPair) pair<int, A>;
|
||||||
|
|
||||||
|
%template(pairP1) pair<int, A*>;
|
||||||
|
%template(pairP2) pair<A*, int>;
|
||||||
|
%template(pairP3) pair<A*, A*>;
|
||||||
|
%template(pairP4) pair<int, int*>;
|
||||||
|
%template(pairP5) pair<int*, int>;
|
||||||
|
%template(pairP6) pair<int*, int*>;
|
||||||
|
|
||||||
}
|
}
|
||||||
%std_comp_methods(std::pair<std::pair<std::string, int>, int>);
|
%std_comp_methods(std::pair<std::pair<std::string, int>, int>);
|
||||||
|
|
||||||
|
|
@ -92,6 +100,11 @@ std::pair<int, int>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::pair<int, A*>
|
||||||
|
p_identa(const std::pair<int, A*>& p) {
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
d_inout(double *INOUT) {
|
d_inout(double *INOUT) {
|
||||||
*INOUT += *INOUT;
|
*INOUT += *INOUT;
|
||||||
|
|
|
||||||
|
|
@ -38,4 +38,12 @@ if pab.first.val != 2:
|
||||||
|
|
||||||
pci = lib_std_pair.CIntPair(1,0)
|
pci = lib_std_pair.CIntPair(1,0)
|
||||||
|
|
||||||
print len(psii)
|
a = lib_std_pair.A(5)
|
||||||
|
p1 = lib_std_pair.pairP1(1,a.this)
|
||||||
|
p2 = lib_std_pair.pairP2(a,1)
|
||||||
|
p3 = lib_std_pair.pairP3(a,a)
|
||||||
|
|
||||||
|
|
||||||
|
if a.val != lib_std_pair.p_identa(p1.this)[1].val:
|
||||||
|
raise RuntimeError
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,10 +31,15 @@
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct C
|
||||||
|
{
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
%template(map_si) std::map<std::string, int>;
|
%template(map_si) std::map<std::string, int>;
|
||||||
|
%template(pair_iC) std::pair<int, C*>;
|
||||||
|
%template(map_iC) std::map<int, C*>;
|
||||||
%template(mmap_si) std::multimap<std::string, int>;
|
%template(mmap_si) std::multimap<std::string, int>;
|
||||||
%template(set_i) std::set<int>;
|
%template(set_i) std::set<int>;
|
||||||
%template(multiset_i) std::multiset<int>;
|
%template(multiset_i) std::multiset<int>;
|
||||||
|
|
@ -58,6 +63,11 @@
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::map<int,C*> mapidentc(const std::map<int,C*>& v)
|
||||||
|
{
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
std::map<int,int> mapidenti(const std::map<int,int>& v)
|
std::map<int,int> mapidenti(const std::map<int,int>& v)
|
||||||
{
|
{
|
||||||
return v;
|
return v;
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,16 @@ map['3'] = 2
|
||||||
|
|
||||||
if map != std_containers.mapident(map):
|
if map != std_containers.mapident(map):
|
||||||
raise RuntimeError, "bad map"
|
raise RuntimeError, "bad map"
|
||||||
|
|
||||||
|
|
||||||
|
mapc ={}
|
||||||
|
c1 = std_containers.C()
|
||||||
|
c2 = std_containers.C()
|
||||||
|
mapc[1] = c1.this
|
||||||
|
mapc[2] = c2
|
||||||
|
|
||||||
|
std_containers.mapidentc(mapc)
|
||||||
|
|
||||||
|
|
||||||
vi = std_containers.vector_i((2,2,3,4))
|
vi = std_containers.vector_i((2,2,3,4))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue