c++

C++ move semantics

In the modern versions of C++ (starting from C++11) one encounters a concept of move semantics. It may confusing a bit, and in this post I am going to provide my notes on the topic (mostly based on Bjarne Stroustrup’s The C++ Programming Language (4th edition): sections 3.3, 7.7.2, 17.5.2). The first important concept is rvalue reference. For a type T, a rvalue reference is T&& (note the double ampresand). It basically represents a reference to a temporary object that is assumed to be modified and not used again.

Exposing C++ array data in Python with the Pybind11 buffer protocol

Python works great together with native code. The success of the Python data science stack is largely attributed to the capability of building native extensions. It is no secret, however, that the out-of-the-box C-based facilities are rather cumbersome to use. Luckily, there are a bunch of alternatives out there. The one I liked the most is Pybind11, a fork of Boost.Python with focus on the modern C++ standards. It is distributed as a lightweight header-only library that can be bundled with your project.