1 %module template_typedef_funcptr
6 // R Swig fails on this test. Because it tries to return a nil SEXP in
9 %include <std_string.i>
15 template<typename T> class Ptr {};
18 typedef Ptr<MCContract> MCContractPtr;
21 %template() Ptr<MCContract>;
24 template <class Contract, typename ContractID, typename CallbackType>
28 static ContractFactory<Contract,ContractID,CallbackType> &getInstance() {
29 static ContractFactory<Contract, ContractID, CallbackType> instance;
34 * CreateXXContractCallback is a pointer to a function taking no arguments and
35 * returning a pointer to an XXContract.
37 typedef MCContractPtr (*CreateMCContractCallback)();
41 //Get around it by changing this:
42 %template(MCContractFactory) ContractFactory<MCContract, std::string, CreateMCContractCallback>;
44 //to a form which expands the typedef:
45 //%template(MCContractFactory) ContractFactory<MCContract, std::string, Ptr<MCContract>(*)()>;
48 typedef MCContractPtr* ContractPtrPtr;
50 // Plain pointers were also causing problems...
51 %template(MCContractFactory2) ContractFactory<MCContract, std::string, ContractPtrPtr>;