#1369 vector template of enums within class error

open
nobody
None
5
2014-09-25
2014-05-11
rwstoneback
No

I am trying to upgrade from SWIG 2.0.4 to 3.0.0. However, I cannot do so because I end up having problems with my vector templates when generating C# wrappers.

Say I have a class "MyClass" within namespace "MyNamespace". And within this class, I have a public enum "MyEnum", like so:

namespace MyNamespace
{
    struct MyClass
    {
        enum MyEnum
        {
            one = 1,
            two = 2,
            three = 3
        };
    };

    typedef std::vector<MyClass::MyEnum> AllMyEnums;
};

In my interface file, to get that typedef working in C#, I do the following:

namespace std
{
%template(AllMyEnums) vector<MyNamespace::MyClass::MyEnum>;
}

It seems like something about it being nested 3 layers deep inside that vector call causes SWIG to mess up generating "AllMyEnums" a bit in 3.0.0. The size(), capacity(), and reserve() functions all end up with unknown size_type things, causing an unknown SWIG class to be generated for it. However, in 2.0.4, this works fine and the size(), capacity(), and reserve() functions all use "uint".

Discussion

  • rwstoneback

    rwstoneback - 2014-06-03

    Any ideas on this?

     
  • rwstoneback

    rwstoneback - 2014-07-09

    Am I creating the template wrong somehow?

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks