You are not logged in.

#1 2012-07-24 17:22:16

From: Italy
Registered: 2009-01-13
Posts: 677

Boost.Python: wrapping template methods in different modules

Hi, I am trying to expose a template method of a class using Boost.Python. Ideally, I do not want to expose all possible template specifications for this method, so I thought about coding wrappers for different template specifications in different modules, and load only those module containing the wrappings I need. These modules look like:

  class_<Factory>("Factory") \
   .def("CreatePluggable", &Factory::CreatePluggable<int, float>, return_internal_reference<>());

In the example above I exposed the <int, float> specification of Factory::CreatePluggable. I can write a similar module to expose, let's say, the <int, int> specification, but then when I load the two modules only the one which is loaded at last wil lbe considered, so I end up with only one specialization exposed.
Is there a way to make things work? Or even better, is there a more proper way to expose template functions and methods?


Board footer

Powered by FluxBB