more cases
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5825 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
49a09a63fb
commit
b38eae9915
4 changed files with 93 additions and 0 deletions
|
|
@ -16,6 +16,7 @@ CPP_TEST_CASES += \
|
||||||
director_stl \
|
director_stl \
|
||||||
implicittest \
|
implicittest \
|
||||||
lib_std_vectora \
|
lib_std_vectora \
|
||||||
|
lib_std_map \
|
||||||
std_containers
|
std_containers
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,11 @@
|
||||||
{
|
{
|
||||||
return conj(a);
|
return conj(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float_complex Conjf(float_complex a)
|
||||||
|
{
|
||||||
|
return conj(a);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
70
Examples/test-suite/python/lib_std_map.i
Normal file
70
Examples/test-suite/python/lib_std_map.i
Normal file
|
|
@ -0,0 +1,70 @@
|
||||||
|
%module lib_std_map
|
||||||
|
|
||||||
|
//#define SWIG_STD_EXTEND_COMPARISON
|
||||||
|
///
|
||||||
|
%include std_pair.i
|
||||||
|
%include std_map.i
|
||||||
|
|
||||||
|
%inline %{
|
||||||
|
struct A{
|
||||||
|
int val;
|
||||||
|
|
||||||
|
A(int v = 0): val(v)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
%}
|
||||||
|
|
||||||
|
namespace std
|
||||||
|
{
|
||||||
|
%template(pairii) pair<int, int>;
|
||||||
|
%template(pairA) pair<int, A*>;
|
||||||
|
%template(mapA) map<int, A*>;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
%inline
|
||||||
|
{
|
||||||
|
std::pair<int, A*>
|
||||||
|
p_identa(std::pair<int, A*> p) {
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::map<int,A*> m_identa(const std::map<int,A*>& v)
|
||||||
|
{
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
%inline %{
|
||||||
|
struct C{};
|
||||||
|
typedef C* pC;
|
||||||
|
|
||||||
|
template <class A, class B>
|
||||||
|
struct Test
|
||||||
|
{
|
||||||
|
Test (A a, B b)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template <class A, class B>
|
||||||
|
struct Test<A, B*>
|
||||||
|
{
|
||||||
|
Test (A a, B* b)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
%}
|
||||||
|
|
||||||
|
|
||||||
|
%template(test_pC) Test<int, pC>;
|
||||||
|
|
||||||
17
Examples/test-suite/python/lib_std_map_runme.py
Normal file
17
Examples/test-suite/python/lib_std_map_runme.py
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
import lib_std_map
|
||||||
|
|
||||||
|
a1 = lib_std_map.A(3)
|
||||||
|
a2 = lib_std_map.A(7)
|
||||||
|
|
||||||
|
|
||||||
|
if 1:
|
||||||
|
p0 = lib_std_map.pairii(1,2)
|
||||||
|
p1 = lib_std_map.pairA(1,a1.this)
|
||||||
|
m = {}
|
||||||
|
m[1] = a1
|
||||||
|
m[2] = a2
|
||||||
|
|
||||||
|
lib_std_map.p_identa(p1)
|
||||||
|
lib_std_map.m_identa(m)
|
||||||
|
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue