When Size Does Matter—K-Ballo

Recently on Tales of C++:

When Size Does Matter

by K-ballo

In the C++ lands every object has mass; for any complete type T, sizeof(T) is greater than zero. This keeps array indexing and pointer arithmetics from collapsing, but it also means that empty objects occupy space. Furthermore, when an empty object is placed in a class next to a bigger member, padding may — and in all likeliness will — be added due to alignment requirements, resulting in an empty member taking more than just one byte of storage.

Certainly something has to be done about this...

Lambda Over Lambda in C++14—Chris Kohlhepp

A nice complement to the C++14 lambda article we linked to yesterday:

Lambda Over Lambda in C++14: The Convergence of Modern C++ on the Lisp Programming Style, Part II

by Chris Kohlhepp

From the article:

Let us see how that simplifies under C++14 and generic lambdas.

Three observations are striking immediately:
1) The use case for a template has disappeared entirely. We simply have a generic function argument x. This matches Lisp.

2) The code is now entirely as brief as Lisp. Where Lisp has a lot of parenthesis, this style of coding develops a lot of “autos.”

3) The mechanics are identical also. Both functions are actually named lambdas...

Introduction to Type Traits in the C++ standard library—Yvonne Ma

"Are you an enum?" "Are you polymorphic?" The answers to these type questions and more are already in your C++11 standard library:

Introduction to Type Traits in the C++ standard library

by Yvonne Ma

From the article:

... As its name suggests, Type Traits exposes different characteristics of types, or simply the “type of type”. In many C++ programming practices, especially these in template metaprogramming, developers may find it difficult to build a template work for all types without knowing the characteristics of a type. That’s the key reason for the emergence of Type Trait...

C++ Templates series—Feabhas

Here's a recent series that just got a new instalment today: It introduces template basics in a nicely explained and accessible way suitable for a gentle introduction, and then going on to progressively help the reader develop stronger template muscles.

C++ Templates series

by Feabhas

An Introduction to C++ Templates

Template Classes

Template Inheritance

Templates and Polymorphism

Template Member Functions

Variadic Templates

Templates of Templates

And today: Template Specialization

From the Introduction:

Templates are a very powerful -- but often very confusing -- mechanism within C++. However, approached in stages, templates can be readily understood (despite their heinous syntax).

The aim of this series of articles is to guide beginners through the syntax and semantics of the foundation concepts in C++ template programming.

Near-final version of Effective Modern C++ available—Scott Meyers

Scott's long-awaited book on using C++11 and C++14 is nearing completion:

Near-Final Draft of Effective Modern C++ Now Available (plus TOC and sample Item)

by Scott Meyers

From the announcement:

Effective Modern C++ is moving closer and closer to reality. This post contains:

  •     Information about availability of an almost-final draft of the book.
  •     The current (and probably final) table of contents.
  •     A link to the I-hope-I-got-it-right-this-time version of my Item on noexcept.

Note: Scott's session at CppCon ("Type Deduction and Why You Care") is based on the first chapter of Effective Modern C++.

A visitor’s guide to C++ allocators—Thomas Köppe

The standard library allocators are one of the more mysterious parts of namespace std, as well as one of the more flexible parts. In this "under construction" article and GitHub repo, Thomas Köppe undertakes to demystify the feature.

A visitor’s guide to C++ allocators (repo)

by Thomas Köppe

From the README:

This repository contains a collection of documents that describe the allocator concept in the standard library of C++11 and beyond. The main guide covers the following topics.

  • Allocator traits
  • Statefulness
  • Fancy pointers
  • Allocator propagation in breadth (container copy, POC{CA,MA,S}) and depth (scoped_allocator_adaptor)

Start reading with the main guide.

Furthermore, there are several worked-out end-to-end examples:

The code for the end-to-end examples is available separately in the example_code directory.

Overload 122 is available

overload-122.PNGOverload 122 is now available. It contains the following C++-related articles, and more:


Overload 122

Musings on Python -- By a C++ Developer

Python and C++ are very different languages. Sergey Ignatchenko walks through things in Python that can confuse a C++ programmer

Activatable Object

Using locks will slow down threaded code. Len Holgate demonstrates how an Activatable Object can reduce the time spent blocked.

Boost 1.56.0 is released

Some welcome news from

Boost 1.56.0 has been released

These open-source libraries work well with the C++ Standard Library, and are usable across a broad spectrum of applications.
The Boost license encourages both commercial and non-commercial use.

This release contains one new library and numerous enhancements and bug fixes for existing libraries.

This is the first release since November of last year, and the last one since Boost migrated from a monolithic Subversion repository to modularized git repositories on The end users should see no change though, since the archives have the same layout as previous releases.

Read the full announcement for all the details, and for download links.

A Clang edition of the C++11/14 Rocks book is now available

Korban's C++11/14 feature overview book now has a Clang edition, in addition to VS2013 and GCC:

Clang Edition of the C++11/14 Rocks Book

by Alex Korban

From the announcement:

Do you use Clang to compile C++? Would you like to know all about the C++11 and C++14 language features it supports?

You can read about them in the new edition of my C++11/14 Rocks book tailored to Clang.


For those who have the GCC edition of the book: you’ll already be familiar with all the C++11 content as GCC also has full C++11 support. However, the Clang edition has full C++14 coverage instead of an overview.