Jonathan Boccara's blog

Generalizing Unordered Named Arguments

Published March 22, 2019 - 0 Comments

Today’s guest post is written by Till Heinzel. Till is a physicist-turned-software developer at Luxion Aps in Denmark, who is very interested in expressive C++ and the growth of the language in a more expressive direction. Till can be found online on LinkedIn. First off, I would like to thank Jonathan for creating FluentCpp and […]

Anna

Published March 19, 2019 - 0 Comments

Hey all, Here is a little personal announcement. (be right back) (10 min later) Right, so I was saying, I had a little personal announcement to share with you. (be back in a minute) (2 min later) Right! So, the little announcement is: a couple of days ago, I had a little girl! Her name […]

Performance benchmark: Ranges VS STL algorithms VS Smart output iterators

Published March 15, 2019 - 0 Comments

Ranges, STL algorithms and smart output iterators are three libraries that perform operations on collections and make code more expressive. Even if they have some specificities, like zip for ranges and unzip for smart output iterators for example, as we saw when combining ranges with output iterators, they also share features in common, such as transform and filter. […]

The Demultiplexer Iterator: Routing Data to Any Numbers of Outputs

Published March 12, 2019 - 0 Comments
demux demultiplexer iterator

In a previous post, we explored the partition output iterator, that routes data into two directions according to a predicate: the elements that satisfy the predicate to one side, and those that don’t to another side: auto const isEvenPartition = partition([](int n){ return n % 2 == 0; }); std::copy(begin(input), end(input), isEvenPartition(back_inserter(evenNumbers), back_inserter(oddNumbers))); The above code […]

STL Algorithms on Tuples

Published March 8, 2019 - 0 Comments

When you manipulate a collection of objects in C++–which is quite a common thing to do when programming in C++–STL algorithms are your loyal companions to perform operations with expressive code. But the STL algorithms, shipped in the standard library with C++, only apply to collections that are filled at runtime, during the execution of […]

Partitioning Data with Output Iterators in C++

Published March 1, 2019 - 0 Comments

A couple of months (or years?) back, we saw that partitioning in the STL meant tidying up data according to a predicate: all that satisfy the predicate in one group, and all that don’t satisfy the predicate in another group: This is what the STL algorithms std::partition (or std::stable_partition to keep the relative order of elements) do: auto […]

Is Unzip a Special Case of Transform?

Published February 26, 2019 - 0 Comments

In the Smart Output Iterators library, the unzip output iterator allows to send the various elements contained in tuples or pairs to as many output collections: std::vector<std::tuple<int, int, int>> lines = { {1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {10, 11, 12} }; std::vector<int> column1, column2, column3; std::copy(begin(lines), end(lines), fluent::output::unzip(back_inserter(column1), back_inserter(column2), back_inserter(column3))); This […]

Applying Several Transforms in One Pass on a Collection

Published February 22, 2019 - 0 Comments

Applying a function to each element of a collection and outputting the results into another collection is a very common thing to do, in C++ or elsewhere. In C++, we have the std::transform algorithm to do this, a central piece of the STL algorithms library. To illustrate, consider the following program: #include <algorithm> #include <iterator> […]