January 2017

How C++ lambda expressions can improve your Qt code—Aurélien Gâteau

Lambdas are helping you.

How C++ lambda expressions can improve your Qt code

by Aurélien Gâteau

From the article:

In case you’ve missed it, lambda expression support has been added to C++ in C++11. In this article we are going to see how to take advantage of lambda expressions in your Qt code to simplify it and make it more robust, but also which pitfalls to avoid...

Stepanov-Regularity and Partially-Formed Objects vs. C++ Value Types—Marc Mutz

Marc Mutz wrote in his recent article about the properties of default constructed object as required by Elements of Programming.

Stepanov-Regularity and Partially-Formed Objects vs. C++ Value Types

by Marc Mutz

From the article:

In this article, I will take a look at one of the fundamental concepts introduced in Alex Stepanov and Paul McJones’ seminal book “Elements of Programming” (EoP for short) — that of a (Semi-)Regular Type and Partially-Formed State.

Using these, I shall try to derive rules for C++ implementations of what are commonly called “value types”, focusing on the bare essentials, as I feel they have not been addressed in sufficient depth up to now: Special Member Functions.

zero-overhead C++17 currying & partial application—Vittorio Romeo

This article briefly explains the concepts of "currying" and "partial application", then covers the design and C++17 implementation of a generic zero-overheader constexpr `curry` function.

zero-overhead C++17 currying & partial application

by Vittorio Romeo

From the article:

[...] many features introduced in the latest C++ standards allow functional patterns to thrive in your codebase, [...] like currying and partial application. [...] In this article we're going to:

* Introduce and briefly explain the two aforementioned concepts.

* Write a generic constexpr zero-overhead `curry` function in C++17.

* Analyze the generated assembly of the implementation to prove the lack of overhead.


Given a generic function object `f`, invoking `curry(f)` will return a curried/partially-applicable version of `f`. If `f` is constexpr-friendly, the returned one will be as well. `curry` should not introduce any overhead compared to hand-written currying/partial application.

Istream Idiosyncrasies—Adi Shavit

Idiosyncrasies with istreams.

Istream Idiosyncrasies

by Adi Shavit

From the article:

A lot has been written and the vice and virtues of the C++ iostreams library.
While working on Argh, my little C++11 argument parsing library, I ran across some somewhat surprising idiosyncrasies and a few interesting lessons.