Articles & Books

Full C++17 Filesystem Library Guide -- Nico Josuttis

The latest update of "C++17 - The Complete Guide" now contains a detailed description of the whole new C++17 filesystem library.

Example Code

by Nico Josuttis

About the extension:

50 pages about all elements, all differences between POSIX/Linux and Windows, many examples, many tricks, traps, and hints as well as what changed with the library when it became part of C++17.

All examples were tested both with Visual C++ and g++.

Beyond the Type System -- Lucian Radu Teodorescu

Ever wondered how the compiler generates code for your types?

Beyond the Type System

by Lucian Radu Teodorescu

From the article:

Often when we consider a type system we think about a complex formalism to denote the semantics of a language. Languages typically add features by increasing the complexity of the type system.

But there is also another perspective on the type system: how does the generated code look like? what is the ABI for the code that uses different features of the type system? We’ll try to explore this perspective in this blog post.

Everything about unity builds -- Viktor Kirilov

A unity build can cut down build times dramatically and is HIGHLY underrated and easily dismissed by many senior software engineers.

Everything about unity builds

by Viktor Kirilov

From the article:

In this post we will go over what it is, all its pros and cons, and why a “dirty hack” might be worth it if it speeds up your builds by at least a factor of 2 or perhaps even in the double-digits.

Functions in std--Andrzej Krzemieński

The Standard reserves the right to change the signatures and overloads of the existing Standard Library functions in what is considered a backward compatible way:

Functions in std

by Andrzej Krzemieński

From the article:

Names of functions from the Standard Library used as pointers/references to functions can cause breakage in your code...

Parallel STL And Filesystem: Files Word Count Example--Bartlomiej Filipek

Now with some more numbers.

Parallel STL And Filesystem: Files Word Count Example

by Bartlomiej Filipek

From the article:

Last week you might have read about a few examples of parallel algorithms. Today I have one more application that combines the ideas from the previous post.

We’ll use parallel algorithms and the standard filesystem to count words in all text files in a given directory...

Functions of Variants are Covariant--Alfredo Correa

It's varying!

Functions of Variants are Covariant

by Alfredo Correa

From the article:

Sum types have a range of values that is the sum of the ranges of its parts. std::variant is the model representation of sum types in C++.

For example std::variant can hold an integer value (int state) or a double value (double state). The use of variant types provides support for polymorphism while maintaining value semantics.

There are only a few intrinsic functions that can be applied directly to an std::variant instance in C++; basically, only functions that probe or extract their current type state and value. Simple C++ functions over its component states cannot be applied directly to the variant since the type information needs to be probed before calling the corresponding function over the correct type.

Specific C++ functions can be applied through visitors. However, standard visitors are static and non-covariant, stopping polymorphism from propagating through function application.

A basic explanation of variants and their visitors can be found here.

The surprisingly high cost of static-lifetime constructors--Arthur O’Dwyer

Today we look at compile time performance.

The surprisingly high cost of static-lifetime constructors

by Arthur O’Dwyer

From the article:

I was looking at HyperRogue again this week (see my previous post). It has a really nice localization framework: every message in the game can be translated just by adding a lookup entry to a single file (like, for the Czech translation, you add entries to language-cz.cpp); and then during the build process, all the language-??.cpp files are collated together and used to produce a single language-data.cpp file with a lookup table from each English message to the same message in every other language. (Seeing all the messages at once allows us to report on how “complete” each translation is, relative to the others.)...

 

The Tightly-constrained Design Space of Convenient Syntaxes For Generic Programming --Corentin Jabot

An exploration of the various convenient syntaxes for declaring templates and function templates as proposed C++20:

The tightly-constrained design space of convenient syntaxes for generic programming

by Corentin Jabot

About the article:

Did you know that the Concept TS was merged into the Working Draft in July 2017, in Toronto? And we are a Planck length away from merging the Range TS in C++20 as well, including a few goodies such as projections, contiguous ranges/iterators and ranges adaptors? We also added a bunch of general-purpose concepts in the std namespace in Rapperswil.

Concepts have been 3 decades in the making and the Ranges TS is a huge body of work. Yet, I feel like a lot of people are unaware of these great features that are coming to a compiler near them.

Examples of Parallel Algorithms From C++17--Bartlomiej Filipek

Do you know them?

Examples of Parallel Algorithms From C++17

by Bartlomiej Filipek

From the article:

MSVC (VS 2017 15.7, end of June 2018) is as far as I know the only major compiler/STL implementation that has parallel algorithms. Not everything is done, but you can use a lot of algorithms and apply std::execution::par on them!

Have a look at few examples I managed to run...