Exposing c++ template classes to python using interrogate...?

just a sample c++ template class…

template<class type1, class type2>
class TempClass {

	type1 int_foo();

template<class type1, class type2>
type1 TempClass<type1, type2>::int_foo() {
	return "454545";

i have a few c++ libraries that relay a lot on templates… so i tried running interrogate on a simple template class first but it isn’t exposed …there is not much documentation on using interrogate so any help is appreciated…
Thanks in advance

Interrogate supports templates, and in fact we rely on it to expose template classes within Panda3D! However, since Python does not support templates, it can only expose specific instantiations of those templates, and it needs some help to choose which ones.

The easiest way to do this is just to create a typedef where interrogate can see it:

typedef TempClass<int, int> TempClassIntInt;

If you want these definitions to only affect interrogate, you can wrap them inside #ifdef CPPPARSER.

The alternative approach is to create a .N file that contains forcetype directives (and possibly also renametype if you want them to be exposed under a special name). See the .N files in the Panda3D repository for an example, such as config_putil.N.