In today’s article, I’ll show you battle-tested features from the well-known Boost libraries that were adapted into C++17.
With the growing number of elements in the Standard Library, supported by experience from Boost you can write even more fluent C++ code.
Read on and learn about the cool things in C++.
Multithreading is a tough nut in software development. Not just because there are dozens of ways to approach a single problem, but also since one can get so many things wrong.
In this article, I want to present how to realize the concept of a Looper with Dispatchers in C++17.
In this post, I’ll show you how to use the newest, low-level, conversion routines form C++17. With the new functionality, you can quickly transform numbers into text and have super performance compared to previous techniques.
Intro Until C++17, we had several ways of converting numbers into strings:
sprintf / snprintf stringstream to_string itoa and 3rd-party libraries like boost - lexical cast And with C++17 we get another option: std::to_chars (along with the corresponding method from_chars) !
Two weeks ago, I had a pleasure to give a talk at our local C++ User Group in Cracow. This time I spoke about vocabulary types from C++17: std::optional, std::variant and std::any.
The Talk During the presentation, I tried to explain the motivation and some most crucial use cases for the new types that we got in C++17.
Last week was an important milestone for my book: it got a print version available at Amazon! In this post, I’ll share some details behind the event and the plans.
The Print (on Demand) Since March 2019, I’ve been testing a few platforms that offer print on demand. One book came from Lulu.
Last week’s article about smaller C++17 features mentioned updated operator new() that handles non-standard alignment of objects. How does it work? Can you use it to ask for arbitrary alignments? Let’s try some code and have a closer look.
Last update: 9th September 2019
Why should you care about alignment?
When you see an article about new C++ features, most of the time you’ll see a description of major elements. Looking at C++17, there are a lot of posts (including articles from this blog) about structured bindings, filesystem, parallel algorithms, if constexpr, std::optional, std::variant… and other prominent C++17 additions.
Two weeks ago, I showed you a sample that can detect if a function has a given overload. The example revolved around std::from_chars - low-level conversion routine for C++17. In the example, some “heavy” template patterns helped me to write the final code (most notably std::void_t and if constexpr). Maybe there are some other techniques we can use to check if a feature is available or not?
The problem: a library function offers several overloads, but depending on the implementation/compiler, some of the overloads are not available. How to check the existence of an overload? And how to provide a safe fallback?
In this article, I’ll show you a background “theory” and one case - std::from_chars that exposes full support for numbers or only integer support (in GCC, Clang).
If you have two function overloads foo(): one is taking const std::string& and the other taking bool. Which one of them will be selected when you call foo("hello world"); ?
Let’s see where such a case might bite us and cause troubles?
Intro Here’s the example once again
void foo(const std::string& in) { std::cout << in << '\n'; } void foo(bool in) { std::cout << "bool: " << in << '\n';} foo("Hello World"); What’s the output?
Last Friday my book got a fresh update! It’s been three months since the previous release, and this time I brought foreword, new book format and some small content changes.
Changes Here are the main changes:
Foreword First of all the book has now a foreword, and it’s written by Herb Sutter!
As you may know std::filesystem evolved directly from Boost filesystem library. For a long time, it was available as a Technical Specification and later merged into C++17. Developers who used Boost can ask themselves what the differences between the two libs are. Can the code be easily converted to use std::filesystem?