fix template + typedef issue reported by Bo Peng

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@8733 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2006-02-06 23:42:37 +00:00
commit 511e4895b1
2 changed files with 38 additions and 8 deletions

View file

@ -2,16 +2,15 @@
%include "std_vector.i"
%inline
{
#include <iostream>
%inline {
namespace simuPOP
{
// some simple pop class
struct pop {
template <class Type>
struct Population {
int m_a;
pop(int a):m_a(a){}
Population(int a):m_a(a){}
};
// base operator, output pop.m_a
@ -32,9 +31,40 @@ namespace simuPOP
virtual int func() const
{ return 2*this->m_pop.m_a; }
};
}
}
#if 1
namespace simuPOP
{
%template(population) Population< std::pair<unsigned long,unsigned long> >;
}
%inline
{
namespace simuPOP
{
typedef Population< std::pair<unsigned long,unsigned long> > pop;
}
}
#else
%inline
{
namespace simuPOP
{
// %template(population) Population< std::pair<unsigned long,unsigned long> >;
struct pop {
int m_a;
pop(int a):m_a(a){}
};
}
}
#endif
namespace simuPOP
{
%template(baseOperator) Operator< pop >;