From: Botos, C. <cb...@ae...> - 2013-05-22 15:30:51
|
Hi, I have a struct that contains a member that is a vector of a class with no default constructor that is not compiling. I condensed the problem into the short example below that gives a few of the following compile errors: error: no matching function for call to Instrument::Instrument() I tried applying what is said about this in Section 6.6.1 "Constructors and destructors" but without success. Can someone suggest how I might get around this? Here's the example code: //--------------------------------------------------------- %module Band %feature("autodoc", "1"); //%feature("valuewrapper") Instrument; //%clearnodefaultctor; //%nodefaultctor Instrument; //%feature("notabstract") Instrument; %{ #define SWIG_FILE_WITH_INIT #include <vector> class Instrument { public: Instrument(int aNote) : theNote(aNote) {} int play() {return theNote;} private: int theNote; }; struct Section { std::vector<Instrument> theInstruments; }; %} %include "std_vector.i" typedef std::list<PG::L2::LS::DateTime> DateTimeVector; typedef std::vector<Instrument> InstrumentVector; %template(InstrumentVector) std::vector<Instrument>; //--------------------------------------------------------- Thanks in advance. Regards, Chris |