A set of template template template parameters using SWIG

I have a C ++ class, for example:

template< template<typename> class ContainerType, typename MemberType>
class MyClass
{
  public:
    MyClass(ContainerType<MemberType>* volData);
}

which I am trying to wrap using SWIG. My MyClass.i looks like this:

%module MyClass
%{
  #include "SimpleContainer.h"
  #include "MyClass.h"
%}

%include "SimpleContainer.h"
%include "MyClass.h"

%template(MyClass_SimpleContainer_Int) MyClass<SimpleContainer, int>;

However, SWIG seems to have problems with the template template parameter. When compiling, it complains about the error message:

MyClassPYTHON_wrap.cxx:30545:3: error: ‘ContainerType’ was not declared in this scope

Looking at this line in the generated code, it contains the line:

ContainerType< int > *arg1 = (ContainerType< int > *) 0 ;

For some reason, it uses the dummy template name literally as the class name, although I told him that there should be a ContainterType for the SimpleContainer in this instance of the class.

Is there a way I can get around this error? I found a mention of this in the SWIG tracker , but I could not understand the workaround mentioned in the last post, and also that the error is 4 years.

I am using SWIG 1.3.40 and GCC 4.5.1 on openSUSE 11.4

+5
1

++ . :

template<class ContainerType, typename MemberType>
-1

All Articles