advanced

Red Hat at the ISO C++ Standards Meeting (Nov 2017): Parallelism and Concurrency—Torvald Riegel

Discover how C++ evolves:

Red Hat at the ISO C++ Standards Meeting (November 2017): Parallelism and Concurrency

by Torvald Riegel

From the article:

Several Red Hat engineers attended the JTC1/SC22/WG21 C++ Standards Committee meetings in November 2017. This post focuses on the sessions of SG1, the study group on parallelism and concurrency. SG1 had a full schedule as usual, with Executors, Futures, and deferred reclamation mechanisms (e.g., RCU) being major discussion topics. We also started to track the state of proposals and topics we will need to discuss in a publicly accessible bug tracker...

Your own type predicate—Andrzej Krzemieński

A very detailled and complete article to start playing with template predicates!

Your own type predicate

by Andrzej Krzemieński

From the article:

In this post we will see how to define a type trait or a type predicate or a meta-function that would allow us to check at compile time whether a type exposes an interface that we need. That is, we want to check if a given type T has:

  • nested typename result_type,
  • static member function set_limit that takes one argument of type int,
  • member function get_result that returns type const result_type& and that is declared not to throw exceptions...

The Boost C++ Master Class with Boris Schäling

Boris Schäling offers a new C++ master class.

The Boost C++ Master Class

by Boris Schäling

About the training:

Welcome to a 2-day training that strives to deepen your understanding of the Boost C++ Libraries. As of today, the Boost C++ Libraries are the most important stepping stone if you want to increase your productivity as a C++ developer and significantly improve the quality of your code. In-depth knowledge of the Boost C++ Libraries empowers you to write code that is shorter, more expressive, less error-prone, more agile, and more future proof.

Boris Schäling is one of the world’s leading professional Boost C++ expert. He has seen multiple times how detailed knowledge of the Boost C++ Libraries can turn a C++ developer into an exceptional C++ developer. Boris Schäling is an active member of the Boost community. He is the author of the book "The Boost C++ Libraries" and responsible for the website theboostcpplibraries.com.

The training is for intermediate and advanced C++ developers. Advantage if you have some experience with the Boost libraries (prior knowledge of Boost helpful, but not required).

Don’t miss out on the opportunity to attend this 2-day course, to be held in Stockholm on the 13th-14th March, 2018. Please notice there are a limited number of seats.

C++ Coroutines: Understanding operator co_await—Lewis Baker

An article very complete!

C++ Coroutines: Understanding operator co_await

by Lewis Baker

From the article:

In the previous post on Coroutine Theory I described the high-level differences between functions and coroutines but without going into any detail on syntax and semantics of coroutines as described by the C++ Coroutines TS (N4680).

The key new facility that the Coroutines TS adds to the C++ language is the ability to suspend a coroutine, allowing it to be later resumed. The mechanism the TS provides for doing this is via the new co_await operator.

Understanding how the co_await operator works can help to demystify the behaviour of coroutines and how they are suspended and resumed. In this post I will be explaining the mechanics of the co_await operator and introduce the related Awaitable and Awaiter type concepts.

But before I dive into co_await I want to give a brief overview of the Coroutines TS to provide some context...

Implementing the spaceship operator for optional—Barry Revzin

The future implementation?

Implementing the spaceship operator for optional

by Barry Revzin

From the article:

Last week, the C++ Standards Committee added operator<=>, known as the spaceship operator, to the working draft for what will eventually become C++20. This is an exciting new language feature for two reasons: it allows you to write one function to do all your comparisons where you used to have to write six, and it also allows you to write zero functions — just declare the operator as defaulted and the compiler will do all the work for you! Exciting times...

Keynotes at Meeting C++ 2017

With the conference just a few weeks away, an update on the 3 awesome keynotes of this years Meeting C++:

Keynotes at Meeting C++ 2017

by Jens Weller

From the article:

Are you excited for Meeting C++ 2017?!? I quickly wanted to give an update on the 3 keynotes at the conference this year! Each day will feature one keynote, where the first two are in the morning, while the Closing Keynote is kind of the last thing to happen before the closing message. Also, all 3 keynote speakers have now (finally) their speaker profile.

CppCon 2017: What Has My Compiler Done for Me Lately? Unbolting the Compiler’s Lid—Matt Godbolt

The CppCon 2017 endnote is now available! What an excellent talk by Matt, of Godbolt fame.

What Has My Compiler Done for Me Lately? Unbolting the Compiler's Lid

by Matt Godbolt

From the article:

In 2012, Matt and a colleague were arguing whether it was efficient to use the then-new-fangled range for. During the discussion a bash script was written to quickly compile C++ source and dump the assembly. Five years later and that script has grown into a website relied on by many to quickly see the code their compiler emits, to compare different compilers' code generation and behaviour, to quickly prototype and share code, and investigate the effect of optimization flags.

In this talk Matt will not only show you how easy (and fun!) it is to understand the assembly code generated by your compiler, but also how important it can be. He'll explain how he uses Compiler Explorer in his day job programming low-latency trading systems, and show some real-world examples. He'll demystify assembly code and give you the tools to understand and appreciate how hard your compiler works for you.

He'll also talk a little about how Compiler Explorer works behind the scenes, how it is maintained and deployed, and  share some stories about how it has changed over the years. By the end of this session you'll be itching to take your favourite code snippets and start exploring what your compiler does with them.

Detection Idiom - A Stopgap for Concepts—Simon Brand

Concepts are not yet here, but there are solutions.

Detection Idiom - A Stopgap for Concepts

by Simon Brand

From the article:

Concepts is a proposed C++ feature which allows succinct, expressive, and powerful constraining of templates. They have been threatening to get in to C++ for a long time now, with the first proposal being rejected for C++11. They were finally merged in to C++20 a few months ago, which means we need to hold on for another few years before they’re in the official standard rather than a Technical Specification. In the mean time, there have been various attempts to implement parts of concepts as a library so that we can have access to some of the power of Concepts without waiting for the new standard. The detection idiom – designed by Walter Brown and part of the Library Fundamentals 2 Technical Specification – is one such solution. This post will outline the utility of it, and show the techniques which underlie its implementation.

Automatic two-phase init—Krzysztof Ostrowski

Deferred initialisation for classes that inherit constructors, or Automatic two-phase init.

Deferred initialisation for classes that inherit constructors

by Krzysztof Ostrowski

From the article:

Constructor inheritance through using-declaration is a powerful technique that can be easily used to introduce pre-defined behaviour to custom types. As an example, consider a generic visitor design pattern implementation that is parametrised by the names of visitable types, and an unique tag that identifies given visitor template instance. Such an instance can be "mixed-in" into a custom type D by simply deriving from it... and inheriting its constructors to make it behave as it would be a Visitor template instance itself:

struct D
  : Visitor<
        A         // the tag
      , X, Y, Z   // "list" of visitable types
      >
{
    using Visitor::Visitor;
};
What if there is a need to run an "additional" initialisation code as it would be run in the D constructor if one were there? Bjarne Stroustrup suggests member-initializers that do half of a work we would like to do here. While direct member initialisation sets required initial values for all the members (except bit field members), it does not offer a direct way to execute custom code that makes use of those members, the custom code that typically resides in the constructor's body.
This article presents a solution that enables injection of a custom code to be executed once all the non-static members are initialised.