In C++20, the standard library introduced new synchronization primitives: std::latch and std::barrier. These are the utilities designed to coordinate between concurrent threads. What is a synchronization primitive? In concurrent programming, synchronization primitives are the fundamental tools that help in managing the coordination, execution order, and data safety of multiple threads or processes that run concurrently. […]
C++ Get the RSS Feed
Content related to C++
Qt and Trivial Relocation (Part 5) Trivial Relocation and Standard C++
In the previous posts of this series (if you’ve missed them: parts 1, 2, 3, and 4), we have learned about relocation and trivial relocation. We have explored what relocation means, what trivial relocation means, and how it can be used to optimize the implementation of certain data structures, such as the reallocation of a […]
More Ways to Rust
In our earlier blog, The Smarter Way to Rust, we discuss why a blend of C++ and Rust is sometimes the best solution to building robust applications. But when you’re merging these two languages, it’s critical to keep in mind that the transition from C++ to Rust isn’t about syntax, it’s about philosophy. Adapting to […]
The Smarter Way to Rust
If you’ve been following our blog, you’re likely aware of Rust’s growing presence in embedded systems. While Rust excels in safety-by-design, it’s also common to find it integrated with C++. This strategic approach leverages the strengths of both languages, including extensive C++ capabilities honed over the years in complex embedded systems. Let’s delve into some […]
Qt and Trivial Relocation (Part 4) On trivial relocation and move assignments
In the last post of this series we learned that: erasing elements from the middle of a vector can be implemented, in general, via a series of move assignments, move constructions, swaps, destructions for types with value semantics, the exact strategy does not really matter for types with write-through reference semantics, the strategy matters, because […]
Qt and Trivial Relocation (Part 3) Trivial relocability for vector erasure, and types with write-through reference semantics
In the last post of this series we started exploring how to erase an element from the middle of a vector. We discussed that in principle there are several different possible ways to implement erase().For instance, a vector could move-assign over the elements to be erased: Alternatively, a vector could use rotations or some other […]
Qt and Trivial Relocation (Part 2) Relocation and Erasure
In the last post of this series we discussed the usage of trivial relocation in order to optimize move construction followed by the destruction of the source. To quickly recap: objects of certain datatypes (“trivially relocatable” types) can be moved in memory by simply moving bytes; this can be used to optimize certain bulk operations […]
Qt and Trivial Relocation (Part 1) What is relocation?
The container classes introduced in Qt 4 (Tulip, for the aficionados) had an interesting optimization: the ability to turn certain operations on the contained objects into byte-level manipulations. Example: vector reallocation Consider the reallocation of a QVector<T>: when the vector is full and we want to insert a new value (of type T), the vector […]
Mixing C++ and Rust for Fun and Profit: Part 3 How to not reinvent the wheel
In the two previous posts (Part 1 and Part 2), we looked at how to build bindings between C++ and Rust from scratch. However, while building a binding generator from scratch is fun, it’s not necessarily an efficient way to integrate Rust into your C++ project. Let’s look at some existing technologies for mixing C++ […]
Introducing the ConnectionEvaluator in KDBindings Control When Connections are Emitted
Managing the timing and context of signals and slots in multithreaded applications, especially those with a GUI, can be a complex task. The concept of deferred connection evaluation offers a nice and easy API, allowing for controlled and efficient signal-slot connections. This approach is particularly useful when dealing with worker threads and GUI threads. A […]