title: SWIG: Use different names for same template (stl vector)
body: <p>we are using SWIG to create wrapper classes for C# and Python for an application interface.</p>
  
  <p>The interface uses several typedefs for STL containers, some of them for the same specialization.</p>
  
  <p>When running SWIG, in the generated C# file, wrapper functions always return an instance of the the first defined template that matches the argument list. The generated C++ wrapper module uses the correct typedefs, though.</p>
  
  <p>The following snippet is a very simplified .i file that illustrates the problem:</p>
  
  <pre><code>%module swig
  
  %include "std_vector.i"
  %template(WrappedVectorOfInts) std::vector&lt;int&gt;;
  %template(WrappedIntVector) std::vector&lt;int&gt;;
  %template(WrappedAnotherIntVector) std::vector&lt;int&gt;;
  
  typedef std::vector&lt;int&gt; IntVector;
  typedef std::vector&lt;int&gt; AnotherIntVector;
  
  std::vector&lt;int&gt; GetVectorOfInts();
  IntVector GetIntVector();
  AnotherIntVector GetAnotherIntVector();
  </code></pre>
  
  <p>This results in the follwing CSharp class:</p>
  
  <pre><code>public class swig {
    public static WrappedVectorOfInts GetVectorOfInts() {
      WrappedVectorOfInts ret = new WrappedVectorOfInts(swigPINVOKE.GetVectorOfInts(), true);
      return ret;
    }
  
    public static WrappedVectorOfInts GetIntVector() {
      WrappedVectorOfInts ret = new WrappedVectorOfInts(swigPINVOKE.GetIntVector(), true);
      return ret;
    }
  
    public static WrappedVectorOfInts GetAnotherIntVector() {
      WrappedVectorOfInts ret = new WrappedVectorOfInts(swigPINVOKE.GetAnotherIntVector(), true);
      return ret;
    }
  
  }
  </code></pre>
  
  <p>The generated CXX file contains the correctly typed wrapper methods:</p>
  
  <pre><code>SWIGEXPORT void * SWIGSTDCALL CSharp_GetVectorOfInts() {
    void * jresult ;
    std::vector&lt; int &gt; result;
  
    result = GetVectorOfInts();
    jresult = new std::vector&lt; int &gt;((const std::vector&lt; int &gt; &amp;)result); 
    return jresult;
  }
  
  
  SWIGEXPORT void * SWIGSTDCALL CSharp_GetIntVector() {
    void * jresult ;
    IntVector result;
  
    result = GetIntVector();
    jresult = new IntVector((const IntVector &amp;)result); 
    return jresult;
  }
  
  
  SWIGEXPORT void * SWIGSTDCALL CSharp_GetAnotherIntVector() {
    void * jresult ;
    AnotherIntVector result;
  
    result = GetAnotherIntVector();
    jresult = new AnotherIntVector((const AnotherIntVector &amp;)result); 
    return jresult;
  }
  </code></pre>
  
  <p>I've tried with %clear and %apply already, but I always seem to make a mistake, because I never get the desired effect.</p>
  
  <p>Is there a way to force SWIG to use the correct typenames in the generated C# interface?</p>
  
  <p>We are currently using SWIG-3.0.2 on Windows.</p>
  
  <p>Thank you!</p>