swig/Examples/test-suite/template_specialization_defarg.i
Marcelo Matus 50b87f398b more examples, and fixes
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6432 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-10-18 02:08:55 +00:00

95 lines
1.1 KiB
OpenEdge ABL

%module template_specialization_defarg
%inline %{
template <class A, class B = double>
struct C
{
};
template <class BB>
struct C<int , BB>
{
int hi()
{
return 0;
}
C(int a)
{
}
};
template <class BB>
struct C<double , BB>
{
int hello()
{
return 0;
}
C(double a)
{
}
};
template <class T>
struct Alloc
{
};
template <class T, class A = double >
struct D
{
D(int){}
};
template <>
struct D<double>
{
D(){}
int foo() { return 0; }
};
template <class T, class A = Alloc<T> >
struct Vector
{
Vector(int){}
};
template <>
struct Vector<double>
{
Vector(){}
int foo() { return 0; }
};
%}
//
// This works fine
//
%template(C_i) C<int, double>;
//
// This one fails
//
%template(C_dd) C<double,double>;
%template(C_d) C<double>;
%template(D_i) D<int>;
%template(D_d) D<double>;
%template(Vector_i) Vector<int>;
%template(Vector_d) Vector<double, Alloc<double> >;