## experimental

### Mathematics behind Comparison #4: Three-Way Comparison—Jonathan Müller

Everything you need to know!

### Mathematics behind Comparison #4: Three-Way Comparison

by Jonathan Müller

From the article:

In order to sort a collection of elements you need to provide a sorting predicate that determines when one element is less than the other. This predicate must “induce a strict total ordering on the equivalence classes” according to cppreference. Wait, what?

The upcoming C++ spaceship operator implements a three-way comparison, i.e. it is a single function that can return the results of <, == and > combined. But related to it are terms like “strong equality” and “weak ordering” which are somewhat confusing if you don’t have the mathematical background.

So let’s untangle it: This series will explain both the mathematics behind equality and ordering, as well as give concrete guidelines for implementing the comparison operators and the spaceship operator.

Now that we’ve covered both equivalence and ordering relations we can finally talk about the spaceship operator and three-way comparisons...

The future?

### Spaceship Operator

by Simon Brand

From the article:

You write a class. It has a bunch of member data. At some point, you realise that you need to be able to compare objects of this type. You sigh and resign yourself to writing six operator overloads for every type of comparison you need to make. Afterwards your fingers ache and your previously clean code is lost in a sea of functions which do essentially the same thing. If this sounds familiar, then C++20’s spaceship operator is for you. This post will look at how the spaceship operator allows you to describe the strength of relations, write your own overloads, have them be automatically generated, and how correct, efficient two-way comparisons are automatically rewritten to use them...

### CppCon 2017: Building C++ Modules—Boris Kolpackov

Have you registered for CppCon 2018 in September? Registration is open now.

While we wait for this year’s event, we’re featuring videos of some of the 100+ talks from CppCon 2017 for you to enjoy. Here is today’s feature:

### Building C++ Modules

by Boris Kolpackov

Summary of the talk:

C++ Modules TS is now implemented (to various degrees) by GCC, Clang, and MSVC. The aim of this talk is to provide practical information on the mechanics of creating and consuming modules with these compilers. It is based on our experience adding modules support to the build2 toolchain and then modularizing some of its components.

We start with a brief introduction to C++ modules, why we need them, and how they relate to other physical design mechanisms, namely headers, namespaces, and libraries.

Next we explore the kind of integration modules will require from a C++ build system. Specifically, when and where a module binary interface is built? How can a build system discover which modules are needed? What are the implications for parallel and distributed builds? Can we finally get rid of the preprocessor? And what happens to header-only libraries in this brave new modularized world?

With a firm understanding of the implications C++ modules have on the build process, we can try to answer some of the module design questions: What is an appropriate module granularity? Should we have separate module interface and implementation units? Can we have a dual header/module interface for legacy support? Are module-only libraries to become all the rage?

### Announcing “trivially relocatable”—Arthur O’Dwyer

Do you want this?

### Announcing “trivially relocatable”

by Arthur O’Dwyer

From the article:

Frequent users of Compiler Explorer, a.k.a. godbolt.org, may have noticed that a few days ago a new compiler appeared in its dropdown menu. “x86-64 clang (experimental P1144)” is a branch of Clang which I have patched to support the concept of “trivially relocatable types,” as described in my C++Now 2018 talk and as proposed for standardization in my upcoming paper P1144 “Object relocation in terms of move plus destroy” (coauthored with Mingxin Wang)...

### GoingNative 67: ISO C++ @ Rapperswil Debriefing—Steve Carroll

C++ is still getting better.

### GoingNative 67: ISO C++ @ Rapperswil Debriefing

by Steve Carroll

From the video:

In this GoingNative episode, we go over the latest news from the ISO C++ Standards Committee meeting in Rapperswil, Switzerland! Steve Carroll chats with Gabriel Dos Reis and Billy O'Neal about the latest news!

### CppCon 2017: A modern formatting library for C++—Victor Zverovich

Have you registered for CppCon 2018 in September? Early bird registration is open now.

While we wait for this year’s event, we’re featuring videos of some of the 100+ talks from CppCon 2017 for you to enjoy. Here is today’s feature:

### A modern formatting library for C++

by Victor Zverovich

Summary of the talk:

Come learn about the intricacies of C++ formatting, from stdio to iostream to the new standard proposal P0645R0: Text Formatting. The new proposal combines variadic templates with a Python-like format string syntax and is designed for performance, extensibility, and safety. It is based on the popular fmt library that has been successfully used in numerous projects in such diverse areas as gaming, mathematical optimization, autonomous vehicles, databases, logging libraries and more.

### C++20 features described in Before/After tables (“Tony Tables”)—Tony Van Eerd

Useful to keep an eye on the evolution.

### C++20 features described in Before/After tables ("Tony Tables")

by Tony Van Eerd

From the article:

C++20 features described in Before/After tables ("Tony Tables")

This is an attempt to succinctly describe the main (not all) features of C++20, and to update these docs as features are moved through the committee...

Nothing is easy.

### App-level Developer on std::error Exceptions Proposal for C++. Part II. The Discussion.

by "No Bugs" Hare

From the article:

For quite a long while, in certain parts of C++ community, there is a substantial resistance to existing C++ exceptions; this leads to an alternative subculture of using error codes instead of exceptions, so there are effectively two barely-compatible C++ worlds: world-using-exceptions, and world-using-error-codes...

### App-level Developer on std::error Exceptions Proposal for C++. Part I. The Good

by "No Bugs" Hare

From the article:

Very recently (that’s less than 3 weeks ago) a very audacious proposal was published by no less than Herb Sutter, under the name of [P0709R0]...

### std::iterator is deprecated: Why, What It Was, and What to Use Instead—Jonathan Boccara

You've been warned.

### std::iterator is deprecated: Why, What It Was, and What to Use Instead

by Jonathan Boccara

From the article:

C++17 has deprecated a few components that had been in C++ since its beginning, and std::iterator is one of them.

If you don’t have C++17 in production, you’re like most people today. But one day or the other, your will have it, most likely. And when that day comes, you’ll be glad you anticipated the deprecation of such components, and stopped using them well in advance.

Let’s see how std::iterator was used, why it was deprecated, and what to use instead.