/images/p1.jpg

Hi, I'm Tomasz

I'm a professional C++ software engineer with over a decade of hands on development experience with variety of technologies (mostly Linux & embedded systems). This is my blog.

Find me on social media

Is 'rope' data structure still any relevant in modern applications?

Ropes are an alternative approach to representing strings within memory but do they still hold any strong hand nowadays and if so, why aren’t they as widely adopted as classical character strings? This is something I’m gonna try to explore using a simple C++ implementation and a couple of benchmarks. What are ropes? Rope represents a string in a tree-like fashion. Leaf nodes store the actual characters, while internal tree nodes store weights (mostly).

How to deal with variadic templates and default function arguments?

I’ve recently started to write my own logging library which I encourage you to check out. It’s called libsl. I’ve decided to use fmt::format for log message formatting and expose the most basic interface for logging messages: 1 2 3 void log(const Logger::Level& level, const std::string& msg, std::source_location sl = std::source_location::current()); The premise here is that the user is responsible for providing a pre-formatted message. Additionally, the log function call collects the source location of where it was called so, this information can be used in the log message as well.

How I fell into a CTAD trap

CTAD (class template argument deduction) is a new c++17 feature that similarly to template functions, allows to automatically deduce class template arguments. It allows to simplify some of the meta programming code, since templates instantiation doesn’t have to be done with explicit types but it comes with a bit of caveats as well. Copying vs wrapping Considering a class template like i.e. 1 2 std::optional<int> x{123}; std::optional y{x}; What should the type of second std::optional be?

New C++23 features I'm excited about

Work on c++23 standardisation is well in progress and we already have a couple of new features to play with. Toolchain support varies but some early testing is already possible. I’ve prepared a list of features that I, personally appreciate a lot and which most definitely will improve my code. Let’s go through them. CppCon overview There’s a set of great CppCon talks regarding new additions coming with c++23. Amongst others, a nice, concise and to the point overview is probably best presented by Marc Gregoire.

Introduction to meson build system

Intro I started using meson exclusively for any new C or C++ project I create. It’s much more convenient and less cumbersome than CMake. In this post, I’ll try to give a short introduction to meson and the reasons I like it. My typical meson project layout My projects usually contain small libraries with a set of tests or executables relying on a bunch of libraries. For the purpose of presentation, I’ll start with a demo project, let’s call it libmagick.

Experimenting with parser combinators in non-functional languages

Functional parsing and parser combinators Recently, on my routine round through YouTube and social media, I’ve came across a video from Ashley Jeffs regarding a message broker he’s the author of called Benthos. Benthos itself is very interesting and I recommend to learn more about it, but what especially caught my interest was a different video from Ashley, regarding bloblang - a configuration language for Benthos written using parser combinators. Frankly, this was the first time I’ve heard that term and, intriguing as it sounds, I wanted to learn all about it.

Three C++ misconceptions from C programmers

In this post I’ll try to clarify some of the misconceptions about C++ which I often find in various code bases. People have their habits C++ is a complex language. Part of this complexity stems from legacy. With legacy comes source code which is often bad. Code that is difficult to maintain, which relies on false assumptions. These assumptions have been reinforced in programmers’ minds early on when the language was in its peak popularity (which was probably like 20 years ago) or (even worse) have been adopted from C world by people who still think that C++ is just C with classes.