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 […]
Blog Archives
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++ […]
Reducing Visual Studio Installations with Toolchains
If you work on C++ projects on Windows that need to be built with multiple Visual Studio C++ compiler versions, you need some way to manage the installations of all these build environments. Either you have multiple IDEs installed, or you know about build tools (https://aka.ms/vs/17/release/vs_BuildTools.exe) and maybe keep only the latest full VS IDE […]
Introducing: KDSPDSetup Initialize loggers with simple config files and focus on your code's functionality
KDAB’s newest open-source library is now publicly available: KDSPDSetup! KDSPDSetup is a small library written in modern C++ (≥ 20) that initializes objects from the spdlog library by reading a toml configuration file. This makes setting up loggers more convenient and results in cleaner-looking code. Let’s take a look at an example to see how […]
Mixing C++ and Rust for Fun and Profit: Part 2 Of structs and strings
In the beginning, there was C. That sentence actually could serve as the introduction to a multitude of blog posts, all of which would come to the conclusion “legacy programming conventions are terrible, but realistically we can’t throw everything out and start over from scratch”. However, today we will merely be looking at two ways […]
Qt 6 WASM: Uploading & Playing Back Audio Files Adapting to the limitations of the web platform and Qt Multimedia
This article walks through an implementation using C++11 or later, Qt 6.5 or later for WebAssembly (multithreaded), and CMake. The browser environment used was Mozilla Firefox 119.0.1 (64-bit) provided by the Mozilla Firefox snap package for Ubuntu. Overview & Motivation Lately, I’ve been working on a small Qt Widgets project to help manage some weekly […]
Mixing C++ and Rust for Fun and Profit: Part 1 Or why switching to Rust is such a large undertaking
For quite some time, I have been bothered by this thought: Individual programming languages (C++, Rust, Go, etc.) are traditionally viewed as walled gardens. If your main() function is written in C++, you had better find yourself C++ libraries like Qt to build the rest of your codebase with. Do you want to use Flutter […]
Supercharging VS Code with C++ Extensions
In a previous blog we demonstrated the most straightforward method to optimize Visual Studio Code for a Qt / C++ environment: simply let the tools do all the work! The example GitHub project we discussed automatically installs both the Microsoft C/C++ and clangd extensions into VS Code. You might wonder why you need both C++ […]