<div dir="ltr">Sorry about SWIG -- maybe a chance to move on ;-)<div><br></div><div>I'd go with Cython -- this is pretty straightforward, and it handles the buffer protocol for you under the hood.</div><div><br></div><div>And with XDress, you can get numpy wrapped std::vector out of the box, I think:</div><div><br></div><div><a href="https://s3.amazonaws.com/xdress/index.html">https://s3.amazonaws.com/xdress/index.html</a><br></div><div><br></div><div>if you REALLY want to stick with SWIG, take a look a the SWIG numpy interface files -- they are designed for old-fashioned C, but you could probably adapt them.</div><div><br></div><div>-Chris</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 14, 2014 at 8:59 AM, Toby St Clere Smithe <span dir="ltr"><<a href="mailto:mail@tsmithe.net" target="_blank">mail@tsmithe.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">John Zwinck <<a href="mailto:jzwinck@gmail.com">jzwinck@gmail.com</a>> writes:<br>
> Some time ago I needed to do something similar.  I fused the NumPy C<br>
> API and Boost.Python with a small bit of code which I then<br>
> open-sourced as part of a slightly larger library.  The most relevant<br>
> part for you is here:<br>
> <a href="https://github.com/jzwinck/pccl/blob/master/NumPyArray.hpp" target="_blank">https://github.com/jzwinck/pccl/blob/master/NumPyArray.hpp</a><br>
<br>
</span>There is also a 'Boost.NumPy', which is quite nice, though perhaps a bit<br>
heavy-duty:<br>
<br>
<a href="https://github.com/ndarray/Boost.NumPy/" target="_blank">https://github.com/ndarray/Boost.NumPy/</a><br>
<br>
Cheers,<br>
<br>
<br>
Toby<br>
<div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@scipy.org">NumPy-Discussion@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/numpy-discussion" target="_blank">http://mail.scipy.org/mailman/listinfo/numpy-discussion</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><br>Christopher Barker, Ph.D.<br>Oceanographer<br><br>Emergency Response Division<br>NOAA/NOS/OR&R            (206) 526-6959   voice<br>7600 Sand Point Way NE   (206) 526-6329   fax<br>Seattle, WA  98115       (206) 526-6317   main reception<br><br><a href="mailto:Chris.Barker@noaa.gov" target="_blank">Chris.Barker@noaa.gov</a>
</div>