Articles & Books

Basic dependent typing—Krzysztof Ostrowski

Using fundamental types to do "simple things simple" fits very well in the most of cases.

Basic dependent typing

by Krzysztof Ostrowski

From the article:

If we assume that our application uses only a subset of values carried by given fundamental type, we are likely to get warning from the compiler. We shall take that warning seriously. How to inform type system about our assumptions? Example solutions follow.

C++ User Group Meetings in December

The monthly list of upcoming C++ User Group meetings:

C++ User Group meetings in December

by Jens Weller

From the article:

In total its already 30 groups which are meeting, also there are 10 new groups since the last posting:

Minsk, London, Melbourne, Karlsruhe, Ulm (Qt), San Diego, Belgrade, Luxembourg, Dallas FW, Plano.

The One-Definition Rule—Andrzej KrzemieĊ„ski

Something we should be aware of:

The One-Definition Rule

by Andrzej Krzemieński

From the article:

We have been hit by the same bug twice already this year. It ends in a crash, and it took developers days to find it (in each case), even though it is reproducible on each run of unit tests. The code, after significant simplifications, looks like this:

namespace tests
  struct Fixture
    std::vector<int> v1;
    std::vector<int> v2;

    static Fixture create();

    auto fixture = Fixture::create();
    std::cout << "running test1";

Why you should use Boost.MultiIndex (Part II)—David Gross

The series continue:

Why you should use Boost.MultiIndex (Part II)

by David Gross

From the article:

A few weeks ago, I posted the first part of this article, where I explained the advantages of Boost.MultiIndex over the standard containers when you need to have multiple views on a set of data.

In this second part, I would like to talk about the benefits you can get from using Boost.MultiIndex as a single-index hash table, as a replacement of std::unordered_map.

One interesting and powerful aspect of Boost.MultiIndex is that it allows you to add an index of type T, where T is different from the stored type. And it is more frequent and useful that you could think.

Compose and curry as folds—Nick Athanasiou

With the next version of C++.

Compose and curry as folds

by Nick Athanasiou

From the article:

In a previous post we introduced C++17 fold expressions and described a way to extend them for arbitrary callables. Implementation details don’t matter for what we’re elaborating on here but it should be clear that (given the tools we developed) the following is possible:

(Op<F>(args) + ...)
(... + Op<F>(args))

Guaranteed Copy Elision— Jonas Devlieghere

Guaranteed Copy Elision deserves some attention!

Guaranteed Copy Elision

by Jonas Devlieghere

From the article:

The new C++17 standard brings many exciting new features. A smaller, more subtle improvement it brings is guaranteed copy elision. The keyword is guaranteed, as copy elision itself has always been part of the standard. Although it might not be a change as radical as, say, structured bindings, I'm very happy to see it made it into the standard.

IIFE for Complex Initialization - Bartlomiej Filipek

Try using IIFE to do a complex initialization of a const variable.

<img alt="IFFE for complex initialization" data-cke-saved-src="" src="" 523px;="" height:="" 140px;"="" style="float: right; height: 62px; width: 230px;">


IIFE for Complex Initialization

by Bartlomiej Filipek

From the article:

How do you initialize your variables, especially the const ones? What do you do when the code for the initialization is complicated? Do you move it to other method or just write inside the current scope?