I had tried that but the generated methods tried to use the non-existant default constuctor of the member.

I had to lie to SWIG and tell it that my containers were empty classes with private constructors and the needed typedef to get it working.


On Thu, May 22, 2014 at 4:00 PM, William S Fulton <> wrote:
On 22/05/14 05:24, Nishant Rodrigues wrote:
Sorry, my bad. I got a little excited when I thought it was working.

Any Idea why a typedef would
generate SWIGTYPE_p_std__vectorT_MyType_t__value_type instead of

This is within a macro that converts containers to php arrays:

The point at which the type is used (when the out typemap is needed) is missing the full type information. Unlike a C++ compiler which will complain violently if any type information is missing, SWIG will carry on as it can usually generate code that will compile in such cases, but often the code won't be that usable. As you are using std::vector, you are likely to be missing a %template directive which instantiates the vector so that the value_type is then added to the type system.