title: swig, from list to non-standard vector
body: <p>I want to set up typemap, so that instead of non-standard vector we can pass a Python list.</p>
  
  <p>In C++ I have</p>
  
  <pre><code>template&lt;typename T&gt;
  class mm_vector
  {
  void set_mm_vector(const mm_vector * copy);
  }
  </code></pre>
  
  <p>I want to be able to pass Python list as an argument, so I specify in my .i file:</p>
  
  <pre><code>// python list into vec_of_ints: from Python to C++
  %typemap(in) AMM::mm_vector&lt;int&gt;*
  {
      int i;
      if (!PyList_Check($input))
      {
        PyErr_SetString(PyExc_ValueError, "Expecting a list");
        return NULL;
      }
      Py_ssize_t size = PyList_Size($input); //get size of the list
      for (i = 0; i &lt; size; i++)
      {
        PyObject *s = PyList_GetItem($input,i);
        if (!PyInt_Check(s))
          {
           PyErr_SetString(PyExc_ValueError, "List items must be integers");
           return NULL;
          }
        $1-&gt;push_back((int)PyInt_AS_LONG(s)); //put the value into the array
      }
  }
  </code></pre>
  
  <p>And when I try to run these lines</p>
  
  <pre><code>l=[0,1]
  v = mm.vec_of_ints()
  v.set_mm_vector(l)
  </code></pre>
  
  <p>I have the following error:</p>
  
  <pre><code>File "...", line 1295, in set_mm_vector
  def set_mm_vector(self, *args): return _pyamt.vec_of_ints_set_mm_vector(self, *args)
  
  ValueError: Expecting a list
  </code></pre>
  
  <p>I will be grateful for any suggestion !!!</p>