Wrapping method returning c++ std::array<std::string, 4> in cython
<p>My method returns <code>std::array&lt;std::string, 4&gt;</code> in C++ code. I wrap this code using Cython. I tried to wrap array using memory views. But the result is <code>Invalid base type for memoryview slice: string</code>. So can I wrap my <code>std::array&lt;std::string, 4&gt;</code> to use it in python like list of strs?</p>

<p>The easiest way is probably just to copy to a Python list.</p>

<p>For the sake of this answer I'm assuming you've wrapped your array similar to <a href="http://stackoverflow.com/a/36402807/4657412">this answer</a> and called it <code>arrstr4</code>. The code then looks something like:</p>

<pre><code>def f():
    cdef arrstr4 res = your_cplus_plus_function()
    py_res = []
    for i in range(4):
        py_res.append(res[i]) # take advantage of autoconversion to python string
    return py_res
</code></pre>

python c++ arrays string cython