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:
Marcelo Matus 2004-04-03 08:38:12 +00:00
commit b38eae9915
4 changed files with 93 additions and 0 deletions

View file

@ -16,6 +16,7 @@ CPP_TEST_CASES += \
director_stl \
implicittest \
lib_std_vectora \
lib_std_map \
std_containers
#

View file

@ -45,6 +45,11 @@
{
return conj(a);
}
float_complex Conjf(float_complex a)
{
return conj(a);
}
}

View 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>;

View 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)