Articles & Books

C++ User Group Meetings in January

The January listing of upcoming User Group meetings!

C++ User Group Meetings in January

by Jens Weller

From the article:

The new year has begun, and as I just returned the listing of the User Group Meetings is a bit late...

Yet still, 37 Meetings in January are listed, 7 of them in Austin, as there is a study group for Modern C++ now.

There are 3 new C++ User Groups: Nashua, NH, Vienna (Qt), Austin (Mentoring & Study Group).

Sorting by indices, part 2—Raymond Chen

It seems a simple problem, yet…

Sorting by indices, part 2

by Raymond Chen

From the article:

Before we dig into the Schwartzian transform, let's look at a more conventional generic way to sort by a key:

template<typename Iter, typename UnaryOperation, typename Compare>
void sort_by(Iter first, Iter last, UnaryOperation op, Compare comp)
{
  std::sort(first, last,
            [&](T& a, T& b) { return comp(op(a), op(b)); });
}

The idea here is that you give a unary operator op that produces a sort key, and we sort the items by that key according to the comparer...

passing functions to functions--Vittorio Romeo

How do you pass functions?

passing functions to functions

by Vittorio Romeo

From the article:

Since the advent of C++11 writing more functional code has become easier. Functional programming patterns and ideas are powerful additions to the C++ developer's huge toolbox. (I recently attended a great introductory talk on them by Phil Nash at the first London C++ Meetup - you can find an older recording here on YouTube.)

In this blog post I'll briefly cover some techniques that can be used to pass functions to other functions and show their impact on the generated assembly at the end...

Lazy generators: template deduction on the left-hand side -- Simon Brand

How to do template deduction on the left-hand side of initialization using lazy generators.

Lazy generators: template deduction on the left-hand side

by Simon Brand

From the article:

If you are constructing or assigning to a variable from some function template call, the template magic usually occurs on the right-hand side of the expression. But what if we could deduce the type we want from the left-hand side of the construction?

The Salami Method -- Adi Shavit

C and C++ are probably the only viable languages for true cross-platform development.

The Salami Method

by Adi Shavit

From the article:

The Salami Method finely distinguishes between the different aspects and layers required for exposing platform-independent C++ on different “specific” platforms. At its extreme it strives to create a single, thin, transparent layer for each such aspect so that each layer is more easily built, tested, debugged, managed and maintained.

Applying a permutation to a vector, part 1--Raymond Chen

It seems a simple problem, yet...

Applying a permutation to a vector, part 1

by Raymond Chen

From the article:

Suppose you have a vector indices of N integers that is a permutation of the numbers 0 through N − 1. Suppose you also have a vector v of N objects. The mission is to apply the permutation to the vector. If we let v2 represent the contents of the vector at the end of the operation, the requirement is that v2[i] = v[indices[i]] for all i...