Articles & Books

Generating Sequences

A virtual container.

Generating Sequences

By Anthony Williams

From the article:

I was having a discussion with my son over breakfast about C++ and Python, and he asked me if C++ had anything equivalent to Python's range() function for generating a sequence of integers. I had to tell him that no, the C++ standard library didn't supply such a function, but there were algorithms for generating sequences (std::generate and std::generate_n) into an existing container, and you could write something that would provide a "virtual" container that would supply a sequence as you iterated over it with range-for...

C++ User Group Meetings in March

The monthly overview on upcoming C++ User Group Meetings:

C++ User Group Meetings in March

by Jens Weller

From the article:

The monthly overview on upcoming C++ User Group meetings. Its already 39 User Groups meetings in March, I expect a few more User Groups to announce their meetings in the coming weeks!

There are 3 new C++ User Groups...

C++ User Group Sofia first year

A nice round up on the first year of the C++ User Group in Sofia:

C++ User Group Sofia first year

by Dimitar Mirchev

From the article

Some time in November 2015 we decided that it is a shame that we do not have a C++ User Group in Sofia, Bulgaria, and we decided that instead of waiting to just make it. This is a retro and an overview of what happened in our first year. I hope you find it helpful and inspirational.

HTML Text Editor - final solution

A quick post on the current - and final - solution to use TinyMCE3 with Qt:

HTML Text Editor - final solution

by Jens Weller

From the article:

In the last post about my HTML Text Editor, I mentioned that while the editor worked like it should, other things didn't. I was able to fix at least some of the driver related issues, but kept seeing random crashes. So I decided to try out a different solution, instead of going on a long and tiring debugging trip.

Who Owns Who? (Inverting the PathEngine ownership graph) -- Thomas Young

Blog post about API design for objects with dependencies and lifetime management:

Who owns who

by Thomas Young

About the article

A key take-away is that a simple reference counting strategy can be the ideal way to manage lifetimes for API objects, since, as the API designer we can choose to enforce a directed acyclic graph dependency structure.

Toggles in functions -- Andrzej Krzemieński

A bool or enum by any other name:

Toggles in functions

by Andrzej Krzemieński

From the article:

Have you ever seen a function call like this?

process(true, false);

We are processing something: this should be clear from the context. But what do these parameters mean? What is true and what is false? From the function call we will never figure it out. The code surely isn’t self explanatory.

We will have to stop, and take a look at the declaration, and it does give us a hint:
void process(bool withValidation,
             bool withNewEngine);

Apparently, the author of the function uses the two bools as toggles...

std::transform, a central algorithm -- Jonathan Boccara

And why if you want transform_if you'll really appreciate ranges:

std::transform, a central algorithm

by Jonathan Boccara

From the article:

The concept of std::tranform is so useful that there is a name for it, coming from functional programming: map (unrelated to std::map). In fact, we can see it the other way round: the STL takes its root in functional programming, so it is only normal that a central concept in functonal programming gets a central role in the STL...

Lambda Overdose

Do you feel the same way?

Lambda Overdose

by Arne Mertz

From the article:

Lambdas are a nice recent addition to C++. They are cool, they are hip, and they tend to be overused and misused.

Since lambda expressions came up in C++11 and got a huge boost in usability in C++14, they have been all the rage. Don’t get me wrong. Lambdas really are useful and cool and everything. But reading blog posts, the CppLang Slack channel and other sources lately has given me the impression that some people use lambdas in ways they should not be used...