Articles & Books

C++ in 2015

My yearly overview on the things that might come:

C++ in 2015

by Jens Weller

From the article:

The year is still young, so lets have an outlook about what is going to happen in C++ Land in 2015...

Reader Q&A: auto and for loop index variables -- Herb Sutter

Discussion on how to use/replace auto for loop index variables.

Reader Q&A: auto and for loop index variables

by Herb Sutter

From the reader's question:

So I’ve been reading all I can about c++11/c++14 and beyond when time permits.  I like auto, I really do, I believe in it.  I have a small problem I’m trying to decide what to do about.  So in old legacy code we have things like this:

for (int i = 0; i < someObject.size(); i++) { … }

Implementing std::tuple From The Ground Up – Part 1--Sasha Goldshtein

Sasha Goldshtein begins to show us how to implement the basis of a useful tool from the STL: the tuple.

Implementing std::tuple From The Ground Up – Part 1

by Sasha Goldshtein

From the article:

std::tuple is a very nice facility originally introduced in C++ TR1. It is a heterogenous container of elements that has a statically known size. In C++ 11, std::tuple can be implemented using variadic templates; a single std::tuple class can support an arbitrary number of template type arguments. In this series of blog posts we will implement std::tuple from first principles. The purpose of this exercise is not to provide the best-performing or most-conformant tuple implementation, but rather to see what foundational concepts are required to implement it...

Defensive Programming -- Andrzej Krzemieński

Note that the questions raised are good ones even if we would normally use & parameters for the non-null case.

Today on Andrzej's blog:

Defensive programming

by Andrzej Krzemieński

From the article:

Have you ever asked yourself, or participated in a discussion on whether “defensive programming”is a good or a bad thing? The issue is controversial, and recently, while watching talk “Defensive Programming Done Right, Part I” by John Lakos, I realized (I think) why. Term “undefined behavior” means different things to different people...

Discriminated Unions with boost::python and boost::variant - The Blind Guru

A useful application of boost::variant with boost::python by Mario Lang.

boost::python and boost::variant

by Mario Lang

From the post:

However, there is one aspect of C++ data types that I couldn't figure out how to interface with Python, which are C++ discriminated unions, or more specifically, heterogeneous containers. While Python has no problems with containers containing objects of different types, C++ does not make this very easy by default.

More C++ Idioms -- WikiBooks

This is a catalog of reusable pieces of C++ knowledge, similar to the book on design patterns by GoF.

[An interesting experiment... Note that some material is dated, but it's a wiki. -- Ed.]

More C++ Idioms

C++ has indeed become too "expert friendly" -- Bjarne Stroustrup, The Problem with Programming, Technology Review, Nov 2006.

Stroustrup's saying is true because experts are intimately familiar with the idioms in the language. With the increase in the idioms a programmer understands, the language becomes friendlier to him or her. The objective of this open content book is to present modern C++ idioms to programmers who have moderate level of familiarity with C++, and help elevate their knowledge so that C++ feels much friendlier to them. It is designed to be an exhaustive catalog of reusable idioms that expert C++ programmers often use while programming or designing using C++. This is an effort to capture their techniques and vocabulary into a single work. This book describes the idioms in a regular format: Name-Intent-Motivation-Solution-References, which is succinct and helps speed learning. By their nature, idioms tend to have appeared in the C++ community and in published work many times. An effort has been made to refer to the original source(s) where possible; if you find a reference incomplete or incorrect, please feel free to suggest or make improvements.

The world is invited to catalog reusable pieces of C++ knowledge (similar to the book on design patterns by GoF). The goal here is to first build an exhaustive catalog of modern C++ idioms and later evolve it into an idiom language, just like a pattern language. Finally, the contents of this book can be redistributed under the terms of the GNU Free Documentation License.

Aimed toward: Anyone with an intermediate level of knowledge in C++ and supported language paradigms

 

Await, coroutines, what could that bring for game development

[This article is interesting not only because it's about work being proposed for consideration in the Concurrency TS, but also because it's interesting that we seem to be seeing a trend of articles being published on GitHub instead of on a blog... --Ed.]

 

Await, coroutines, what could that bring for game development

This article shows how we can use await in way not related to threading, tasks, or asynchronous I/O, but in the context of a game, to write game logic-related code spanning accross many frames in a sequencial way, without introducing any threads with little to no performance penalty.