Articles & Books

The Drawbacks of Implementing Move Assignment in Terms of Swap -- Scott Meyers

Hot off the Meyers press: How would you implement move, and why? Scott Meyers explains two related issues:

The Drawbacks of Implementing Move Assignment in Terms of Swap

by Scott Meyers

From the article:

More and more, I bump into people who, by default, want to implement move assignment in terms of swap. This disturbs me, because (1) it's often a pessimization in a context where optimization is important, and (2) it has some unpleasant behavioral implications as regards resource management.

Effective Modern C++ due October, preview in early July -- Scott Meyers

Scott Meyers' highly anticipated new book Effective Modern C++ is on the way:

Effective Modern C++ Status Report

by Scott Meyers

From the announcement:

In recent days, two major milestones for Effective Modern C++ have been achieved. First, I sent a draft of the book's Introduction out for technical review. That was the last part of the book to be written, so I finally have a full draft manuscript. Second, I received an image of the book cover from my publisher, so I now know what the book will look like.

...

  • Early October: Digital versions of the book become available.
  • Late October: Print versions of the book become available.

If you're dying to see what's in the book, and you don't mind dealing with a manuscript that's in draft form (and hence contains technical errors, awkward prose, Item titles in need of revision, primitive diagrams, confusing explanations, and, I hope, some stuff in decent shape), Effective Modern C++ will be part of O'Reilly's Early Release Program, meaning you'll have a chance to see the book in the same form as my technical reviewers. You'll also be able to offer comments on it. As things stand now, the book is slated to be available in Early Release form the week of July 7th.

Using variadic macros -- Andrzej Krzemieński

The latest from the desk of Andrzej:

Using variadic macros

by Andrzej Krzemieński

From the article:

But what struck me was something different. Why is it only some compilers that rejected my code. Why did most of the other compilers accept my apparently buggy code and produced the right result?

The answer is in the title of this post. Boost.StaticAssert is clever and wherever possible it uses variadic macros. ... it is now OK: all these arguments along with the separating commas are forwarded further (e.g., to static_assert) to the code that knows how to interpret these tokens. This is a very nice usage of variadic macros.

Masking a Class in Boost Graph, Part 3: Finding the Path -- Vadim Androsov

Part 3 of Vadim's experience report about using Boost's graph support in an existing game app:

Masking a Class in Boost Graph. Part 3: Finding the Path

by Vadim Androsov

From the article:

In the previous articles of the series we’ve reviewed the adaptive process of the square game field for concepts of boost graphs. Now we’ll consider the process of finding the path in the square field. Implementation of boost search allows adapting the algorithm quite accurately. In this article we’ll provide just one example of such parameterization – an ability to create various lengths of graph edges. ...

Game Changer -- Tony DaSilva

A little more fodder for those still trying to get their management or team to adopt modern C++:

Game Changer

by Tony DaSilva

From the article:

Even though I’m a huge fan of the man, I was quite skeptical when I heard Bjarne Stroustrup enunciate: "C++ feels like a new language". Of course, Bjarne was talking about the improvements brought into the language by the C++11 standard.

Well, after writing C++11 production code for almost 2 years now (17 straight sprints to be exact), I’m no longer skeptical. ... It seems that the authors of the “High Integrity C++” coding standard agree with my assessment. ...

Generator functions in C++ -- Paolo Severini

Paolo Severini expands the concept of resumable functions to support generator functions, providing the ability of lazily producing the values in a sequence only when they are needed.

Generator functions in C++

by Paolo Severini

From the article:

In the previous post we had a look at the proposal of introducing resumable functions into the C++ standard to support writing asynchronous code modeled on the C# async/await pattern.

We saw that it is already possible to experiment with the future resumable and await keywords in Visual Studio, by installing the latest November 2013 CTP. But the concept of resumable functions is not limited to asynchrony; in this post we’ll see how it can be expanded to support generator functions.

Generator functions and lazy evaluation

In several languages, like C# and Python, generator functions provide the ability of lazily producing the values in a sequence only when they are needed. ...

Masking a Class in Boost.Graph -- Vadim Androsov

Here's an experience report about using Boost's graph support in an existing game app, with some notes about Boost Concepts:

Masking a Class in Boost Graph. Part 1: Let the Interface Be

Masking a Class in Boost Graph. Part 2: Completing the Implementation of Concept Support

by Vadim Androsov

From the articles:

I had to rebuild a pathfinding algorithm for our game recently. The previous one (Boost Concepts) was bad as any sidestep was dangerous. So I wanted to take a ready algorithm from a good source. That’s exactly when I remembered about boost as there’s functionality for working with graphs. Unfortunately “find a function, call it and everything will work” approach wasn’t meant to be realized. The library is focused on the maximum use flexibility which has badly affected its simplicity. But it’s better than creating it from scratch (then fixing it). I didn’t want to bother with other libraries, while boost has already been used in the project. ...