Skip to main content

std::move wrapper for cython

Project description

cymove

Build Status Build status

This package is DEPRECATED since std::move support is merged to Cython and available as of v0.29.17 (2020-04-26).

cymove is a header (pxd) only wrapper around C++11 std::move function. It allows using move semantics from cython code.

Installation

pip install cymove

Example Usage

example.pyx:

# distutils: language = c++

from libcpp.memory cimport make_shared, shared_ptr, nullptr
from cymove cimport cymove as move

cdef shared_ptr[int] ptr1, ptr2
cdef int* raw_ptr

ptr1 = make_shared[int](5)
raw_ptr = ptr1.get()
ptr2 = move(ptr1)

assert ptr2.get() == raw_ptr
assert ptr1 == nullptr

print("OK!")

Compile & run:

$ cythonize -3 -i example.pyx
$ python3 -c "import example"
OK!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cymove-1.0.2.tar.gz (3.0 kB view hashes)

Uploaded Source

Built Distribution

cymove-1.0.2-py3-none-any.whl (3.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page