Articles & Books

C++ Best Practices: A Forkable Standards Document - Jason Turner

A forkable coding standards and best practices document for C++.

C++ Best Practices

by Jason Turner

From the book

It (C++ Best Practices) compliments books such as Effective C++ (Meyers) and C++ Coding Standards (Alexandrescu, Sutter). We fill in some of the lower level details that they don't discuss and provide specific stylistic recommendations while also discussing how to ensure overall code quality.


This document is based on my personal experiences. You are not supposed to agree with it 100%. It exists as a book on github so that you can fork it for your own uses or submit back proposed changes for everyone to share.


Using Monads in C++ to Solve Constraints: 3. The Tale of Two Monads—Bartosz Milewski

Bartosz Milewski continues to explain how to use Monads in C++.

Using Monads in C++ to Solve Constraints: 3. The Tale of Two Monads

by Bartosz Milewski

From the article:

The functional solution to our problem involves the combination of the list monad and the state monad. Mashing two monads together is not trivial — in Haskell this is done using monad transformers — but here I’ll show you how to do it manually...

Handling short codes (part I)—Andrzej Krzemieński

First part of a discussion about designing a type storing character strings of length N (known at compile-time and sufficiently small).

Handling short codes - part I

by Andrzej Krzemieński

From the article:

In my work, we often deal with codes [...] The initial choice was to represent them in programs by type std::string, a general-purpose type for storing sequences of characters. But, as with any general-purpose tools, they fail to take into account the particular usage cases which often offer room for improvements [...] The following is an attempt at the design of a type that would take advantage of the information that we are only storing character strings of length N, where N is sufficiently small (say, no longer than 8)...

Using Monads in C++ to Solve Constraints: 2. The State Monad—Bartosz Milewski

Bartosz Milewski continues to explain how to use Monads in C++.

Using Monads in C++ to Solve Constraints: 2. The State Monad

by Bartosz Milewski

From the article:

We all like making plans, but they are often contingent on the state of our finances. Such plans can be described by functions. In general, a financial plan is a function that takes cash and returns the result paired with the new value of cash. It can be described generically using a template...

Using Monads in C++ to Solve Constraints: 1. The List Monad—Bartosz Milewski

Bartosz Milewski starts to explain Monads in his recent article.

Using Monads in C++ to Solve Constraints: 1. The List Monad

by Bartosz Milewski

From the article:

I am sometimes asked by C++ programmers to give an example of a problem that can’t be solved without monads. This is the wrong kind of question — it’s like asking if there is a problem that can’t be solved without for loops. Obviously, if your language supports a goto, you can live without for loops. What monads (and for loops) can do for you is to help you structure your code. The use of loops and if statements lets you convert spaghetti code into structured code. Similarly, the use of monads lets you convert imperative code into declarative code. These are the kind of transformations that make code easier to write, understand, maintain, and generalize.

So here’s a problem that you may get as an interview question. It’s a small problem, so the advantages of various approaches might not be immediately obvious, especially if you’ve been trained all your life in imperative programming, and you are seeing monads for the first time.

C++ Today: The Beast Is Back—Jon Kalb and Gašper Ažman

A new O'Reilly book from two well-known C++ community experts, freely available courtesy of the makers of CLion:

C++ Today: The Beast Is Back

by Jon Kalb and Gašper Ažman

From the announcement:

Now that software development is shifting primarily toward mobile and cloud computing, the venerable C++ programming language is returning to the dominant position it held during the object-oriented boom of the 1990s. In this O′Reilly report, you′ll learn why C++ is once again the preferred choice across several diverse industries...

Table of contents:


1. The Nature of the Beast

C++: What’s It Good For?

2. The Origin Story

C: Portable Assembler
C with High-Level Abstractions
The ’90s: The OOP Boom, and a Beast Is Born
The 2000s: Java, the Web, and the Beast Nods Off

3. The Beast Wakes

Technology Evolution: Performance Still Matters
Language Evolution: Modernizing C++
Tools Evolution: The Clang Toolkit
Library Evolution: The Open Source Advantage

4. The Beast Roars Back

Standard C++ Foundation
Boost: A Library and Organization
Conferences and Groups

5. Digging Deep on Modern C++

Type Inference: Auto and Decltype
How Move Semantics Support Value-Semantic and Functional Programming
No More Output Parameters
Inner Functions with Lambdas
Lambdas as a Scope with a Return Value

6. The Future of C++

Setting the Standard
Never Make Predictions, Especially About the Future


The Annihilation of Conceptual Integrity by Tony DaSilva

A commentary on the C++17 directions being discussed today at the ISO C++ meeting in Kansas, USA:

The Annihilation of Conceptual Integrity

by Tony DaSilva

From the article:

When a large group or committee is tasked with designing a complex system from scratch, or evolving an existing one, I always think of these timeless quotes from Fred Brooks: ... “Who advocates ... for the product itself -- its conceptual integrity, its efficiency, its economy, its robustness? Often, no one.” – Fred Brooks

... Like all the other C++ committee members, Bjarne is a really, really, smart guy. For the decades that I’ve followed his efforts to evolve and improve the language, Bjarne has always expressed empathy for "the little people"; the 99% (of which I am a card-carrying member).
In a world in which the top 1% doesn’t seem to [care] about the remaining 99%, it’s always refreshing to encounter a 1 percenter who cares deeply about the other 99 percenters. And THAT, my dear reader, is what has always endeared Mr. Bjarne Stroustrup to me....

Binary literals and digit separators—Marius Bancila

The title says it all:

Binary literals and digit separators

by Marius Bancila

From the article:

The C++14 standard provides two new small features to the language: binary literals and digit separators. They are already available in Clang 3.4 and GCC 4.9 and now Visual Studio 2015 RC has implemented them. They may not be something you can’t leave without, but sometimes it’s convenient to have them. Let’s have a look...

5 awesome C++ libraries we use—Edouard

An interesting post on interesting librairies:

5 awesome C++ libraries we use

by Edouard

From the article:

This is an opinionated post about five libraries we use in the production code of quasardb.

We of course use many more great libraries (for example Boost.ASIO which is not listed here). Maybe those five libraries are not the most important, but I felt they deserved some special highlight as they are not so well-known or understood...

C++ User Group Meetings in May

The monthly overview on the current user group meetings:

C++ User Group Meetings in May

by Jens Weller

From the article:

    6.5 C++ UG Saint Louis - DD Part 5 - "Atomic" weapons OR ??
    6.5 C++ UG Munich - What is new in VS2015 for C++ Developers
    6.5 C++ UG Saint Louis - "Atomic weapons" part II
    6.5 C++ UG Austin - Charming Python with C++
    7.5 C++ UG NRW/Aachen - C++ User Gruppe (Mai)
    7.5 C++ UG Dresden - Coding Dojo
    11.5 C++ UG Zentralschweiz - Compile-time computation in C++14" mit Prof. Peter Sommerlad
    13.5 C++ UG Utah - Test-Driven Development in C++
    13.5 C++ UG San Francisco/ Bay area - Presentation and Q&A
    15.5 C++ UG Taipei - monthly meetup
    16.5 C++ UG Pune, India - Mastering C++14
    18.5 C++ UG Austin - North Austin Monthly C/C++ Pub Social
    20.5 C++ UG Düsseldorf - Cooking with C++
    20.5 C++ UG Arhus - Kickoff Meeting
    20.5 C++ UG Northwest/Seattle - STL Concepts and Ranges
    21.5 C++ UG Bristol - Lightning Talks
    27.5 C++ UG San Francisco/ Bay area - Workshop and Discussion Group
    27.5 C++ UG Hamburg - C++ Expression Templates
    27.5 C++ UG Udine (Italy)
    28.5 C++ UG Rhein-Neckar - (C++) build system olympics.