From: SourceForge.net <no...@so...> - 2007-11-15 17:03:03
|
Bugs item #1832613, was opened at 2007-11-15 17:02 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=101645&aid=1832613&group_id=1645 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: code generation (general) Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: William Fulton (wsfulton) Assigned to: David M. Beazley (beazley) Summary: templates and function typedef generates uncompileable code Initial Comment: %module example %include <std_string.i> %inline %{ #include <string> template<typename T> class Ptr {}; class MCContract {}; typedef Ptr<MCContract> MCContractPtr; %} %template() Ptr<MCContract>; %inline %{ template <class Contract, typename ContractID, typename CallbackType> class ContractFactory { public: static ContractFactory<Contract,ContractID,CallbackType> &getInstance() { static ContractFactory<Contract, ContractID, CallbackType> instance; return instance; } }; /** * CreateXXContractCallback is a pointer to a function taking no arguments and * returning a pointer to an XXContract. */ typedef MCContractPtr (*CreateMCContractCallback)(); %} //Get around it by changing this: %template(MCContractFactory) ContractFactory<MCContract, std::string, CreateMCContractCallback>; //to a form which expands the typedef: // %template(MCContractFactory) ContractFactory<MCContract, std::string, Ptr<MCContract>(*)()>; /* This gets generated: ContractFactory<MCContract,std::string,Ptr< > (*)() > *result = 0 ; It should be: ContractFactory<MCContract,std::string,Ptr<MCContract > (*)() > *result = 0 ; */ ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=101645&aid=1832613&group_id=1645 |