[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[IMP-dev] Instantiation of boost code



Hi there

I have a problem trying to use a template class based on Boost in
Python. Here is the thing. I write this template:

template<typename T>
class IMPDLLEXPORT MultiArray: public boost::multi_array<T,MULTIARRAY_DIM>
{
  bla, bla ....
}

The problem is that I am not able to get this class in Python. The
only solution that I have found is to create another class that
specifically instantiate the first one:

class IMPDLLEXPORT sillyclass
{
public:
  MultiArray<Float> data_;
};


I've also tried this more clever solution, trying to add this line to
kernel/pyext/IMP.i :
  %template(MultiArrayF) IMP::MultiArray<Float>;

but the compiler or SWIG (I don't know which one) complaints with:

kernel/pyext/IMP.i:114: Warning(401): Nothing known about base class
'boost::multi_array<float,3 >'. Ignored.
kernel/pyext/IMP.i:114: Warning(401): Maybe you forgot to instantiate
'boost::multi_array<float,3 >' using %template.

Something that I don't know to fix.
Help, please.

Javi