Wrapping a vector of vector of ints with CSharp

View: New views
2 Messages — Rating Filter:   Alert me  

Wrapping a vector of vector of ints with CSharp

by baoilleach :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Is it possible to use %template to wrap a vector of vector of ints with CSharp?

I have the following in my interface file:
%include "std_vector.i"
%template (vvInt)      std::vector<std::vector<int> >;

but when I compile the resulting .cs files, I always get "alias 'std'
not found" because of lines like:
    // Type-safe iterator Current
    public std::vector<int > Current {
      get {

I haven't had any problem wrapping the simpler std::vector<int> on its
own. I've also tried preceding the %template line with:
SWIG_STD_VECTOR_SPECIALIZE_MINIMUM(vector, std::vector<init>);
...but with the same result.

Regards,
   Noel

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Swig-user mailing list
Swig-user@...
https://lists.sourceforge.net/lists/listinfo/swig-user

Re: Wrapping a vector of vector of ints with CSharp

by wsfulton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Noel O'Boyle wrote:

> Is it possible to use %template to wrap a vector of vector of ints with CSharp?
>
> I have the following in my interface file:
> %include "std_vector.i"
> %template (vvInt)      std::vector<std::vector<int> >;
>
> but when I compile the resulting .cs files, I always get "alias 'std'
> not found" because of lines like:
>     // Type-safe iterator Current
>     public std::vector<int > Current {
>       get {
>
> I haven't had any problem wrapping the simpler std::vector<int> on its
> own. I've also tried preceding the %template line with:
> SWIG_STD_VECTOR_SPECIALIZE_MINIMUM(vector, std::vector<init>);
> ...but with the same result.
>
You haven't quite got the parameters right for
SWIG_STD_VECTOR_SPECIALIZE_MINIMUM right and you need to wrap
std::vector<int> too. This works:

%include "std_vector.i"
%template (vInt)      std::vector<int>;
SWIG_STD_VECTOR_SPECIALIZE_MINIMUM(vInt, std::vector<int>)
%template (vvInt)      std::vector<std::vector<int> >;

William

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Swig-user mailing list
Swig-user@...
https://lists.sourceforge.net/lists/listinfo/swig-user
LightInTheBox - Buy quality products at wholesale price