New package to help with C++11 things like move semantics.

60 views
Skip to first unread message

Kevin Thornton

unread,
Nov 8, 2016, 3:11:53 PM11/8/16
to cython-users
Hi,

I've been working a lot with move-only objects in C++11.  For example, vectors of unique_ptr.  These types are not totally straightforward to handle in Cython, due to lack of support for lvalue/universal references.  I've come up with some workarounds that may be of general interest to people working with C++11 + Cython.

I've taken some of what I've done that is working well and packaged it separately.  The goal is to use the C++ concepts of SFINAE and variadic templates to generate a set of lightweight, inline-able function templates that can be exposed to Cython.


The README documents 100% of the package. (It is really small right now.)

The .pyx files in cython_mcpp/test contain real examples, like adding unique_ptr to a vector.

Currently, only "emplacement" into containers is supported.  push_back, emplace at location, and insert using std::move and std::make_move_iterator will all come soon.  At that point, I'll get it up onto PyPi.

I hope this is of use to some people.

--Kevin

Denis Akhiyarov

unread,
Nov 9, 2016, 5:32:18 PM11/9/16
to cython-users
I guess you intended to share this link?


Note that this includes some GPL code.

Kevin Thornton

unread,
Nov 9, 2016, 7:25:41 PM11/9/16
to cython-users
Oops--yes, that is the correct link.

The main module code is Apache-licensed.  Only the setup scripts are GPL, which they must be. I got them from another similar project and edited them.
Reply all
Reply to author
Forward
0 new messages