Recover original types in template expansions.
Added the module option "tpltreduc" to force Swig to reduce all the typedef found in a template, usually as a compiler will do. This allows swig to parse very ugly template + typedef code, but it can prevent some typemaps for working. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6527 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
0b2cb3849f
commit
cf7b11c3fd
4 changed files with 55 additions and 23 deletions
|
|
@ -1,5 +1,8 @@
|
|||
#ifdef SWIGPYTHON
|
||||
%module("tpltreduc") template_typedef
|
||||
#else
|
||||
%module template_typedef
|
||||
|
||||
#endif
|
||||
//
|
||||
// Change this to #if 1 to test the 'test'
|
||||
//
|
||||
|
|
|
|||
|
|
@ -1,4 +1,13 @@
|
|||
%module template_typedef_ptr
|
||||
%module("tpltreduc") template_typedef_ptr
|
||||
|
||||
/*
|
||||
Use the "tpltreduc" to force swig to reduce the temaplate
|
||||
typedef as much as possible.
|
||||
|
||||
This fix cases like this one, but it can prevent some
|
||||
typemaps for working.
|
||||
|
||||
*/
|
||||
|
||||
%inline %{
|
||||
struct C{};
|
||||
|
|
@ -13,7 +22,7 @@
|
|||
|
||||
};
|
||||
|
||||
|
||||
|
||||
template <class A, class B>
|
||||
struct Test<A, B*>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,22 +1,33 @@
|
|||
%module template_typemap
|
||||
|
||||
|
||||
%typemap(in) Integer
|
||||
%typemap(in) Integer1
|
||||
{
|
||||
/* do nothing */
|
||||
}
|
||||
|
||||
%typemap(out) Integer
|
||||
%typemap(out) Integer1
|
||||
{
|
||||
/* do nothing */
|
||||
}
|
||||
|
||||
%typemap(in) Integer2
|
||||
{
|
||||
/* do nothing */
|
||||
}
|
||||
|
||||
%typemap(out) Integer2
|
||||
{
|
||||
/* do nothing */
|
||||
}
|
||||
|
||||
%{
|
||||
typedef int Integer;
|
||||
typedef int Integer1;
|
||||
%}
|
||||
|
||||
|
||||
%inline %{
|
||||
typedef int Integer2;
|
||||
|
||||
template <class T>
|
||||
struct Foo
|
||||
|
|
@ -35,8 +46,8 @@
|
|||
};
|
||||
%}
|
||||
|
||||
%template(Foo_i) Foo<int>;
|
||||
%template(Foo_I) Foo<Integer>;
|
||||
%template(Foo_I1) Foo<Integer1>;
|
||||
%template(Foo_I2) Foo<Integer2>;
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue