How to convert (typemap) C++ vector of vectors to Java with SWIG
<p>Could someone help me with the description of <code>SWIG typemap</code> for converting a jagged C++ vector of vectors of type <code>uint32_t</code> to an equivalent java jagged vector of longs?</p>

<p>This is what I have so far in my interface  file and I still end up needing pointer access on my java side. </p>

<p>Would appreciate descriptive code if possible.</p>

<p>Thank you for your time and help.</p>

<pre><code>  %include "std_vector.i"
%{
  #define SWIG_JAVA_EXTRA_NATIVE_CONTAINERS 
%}
%typemap(out) uint32_t %{ $result = (jlong)$1; %}

// Instantiate vector templates used by SimpleR
namespace std {
   %template(IntVector)             vector&lt;int&gt;;
   %template(DoubleVector)          vector&lt;double&gt;;
   %template(LongVector)            vector&lt;uint32_t&gt;;
   %rename(LongVector)              vector&lt;uint32_t&gt;;
   %template(LongVectorVector)      vector&lt;vector&lt;uint32_t&gt; &gt;;
   %template(BooleanVector)         vector&lt;bool&gt;;
   %template(StringVector)          vector&lt;string&gt;;
   %template(ConstCharVector)       vector&lt;const char*&gt;;
   %template(RepresentationVector)  vector&lt;SimpleR::ModelRepresentation *&gt;;
}

// In pop()
%typemap(out) std::vector&lt;std::vector&lt;uint32_t&gt; &gt;::value_type { 
$result = SWIG_NewPointerObj(SWIG_as_voidptr(&amp;$1), $descriptor(std::vector&lt;uint32_t&gt;), 0 |  0 ); 
} 

// In front(), back(), __getitem__()
%typemap(out) std::vector&lt;std::vector&lt;uint32_t&gt; &gt;::value_type &amp; { 
    $result = SWIG_NewPointerObj(SWIG_as_voidptr($1), $descriptor(std::vector&lt;uint32_t&gt;), 0 |  0 ); 
} 
</code></pre>