Articles & Books

Selecting by interface, an idea almost to good to be true

I had an idea last night...

Selecting by interface, an idea almost to good to be true

by Jens Weller

From the article:

Last night, I've been coding until 3 am. Working on an API which will connect my CMS to JSON libraries in a generic way. For this I did study different JSON Libraries in the past weeks. I almost wrote another one wink Yet, I had the idea to write a generic interface to interface with some of these libraries, so that my own code is not hard wired to a certain API...

Automatic event cleanup in C++--Nercury

How to handle events?

Automatic event cleanup in C++

by Nercury

From the article:

Event subscriptions have a downside: someone has to unsubscribe. Usual approach is to make sure it happens when the subscibtion is no longer needed.

But, can we do it automatically, in a way that is easy to use and extend?

Let's see how it can be done in C++...

RAII without exceptions--Eli Bendersky

Is RAII in C++ only possible with exceptions? Eli Bendersky clarifies the matter:

C++: RAII without exceptions

by Eli Bendersky

From the article:

this post is not about whether exceptions are good or bad. What it is about is RAII as a C++ dynamic resource management technique that stands on its own and is useful with or without exceptions. In particular, I want to explain why RAII is indeed useful even if you have exceptions disabled in your C++ code...

Notes on C++ SFINAE -- Bartlomiej Filipek

Bartlomiej explains in his recent blog post in nice details the SFINAE construct.

Notes on C++ SFINAE

by Bartlomiej Filipek

From the article:

This time I’d like to tackle a bit more complex problem: SFINAE. I’m not using this paradigm on a daily basis, but I’ve stumbled across it several times and I thought it might be worth trying to understand this topic.

What is SFINAE? Where can you use it? Do you need this on a daily basis? Let’s try to answer those questions.

In the article he goes into details of Overload Resolution, Where can I use it?, enable_if, Expression SFINAE, Any disadvantages?, and Alternatives to SFINAE.

Revisiting QWidgets & data, refactoring and performance

A follow up on an older Blog post of mine:

Revisiting QWidgets & data, refactoring and performance

by Jens Weller

From the article:

My CMS project has grown quite a bit, and there are a few places where I think I should refactor the code. One of the larger ones is that TreeItem::get<T> returns a pointer instead of a reference. Another one is related to how the Qt UI application is acting when opening a new panel in the TabControl. There used to be a noticeable delay...

The promises and challenges of std::async task-based parallelism in C++11 -- Eli Bendersky

How to use std::async for task-based parallelism in C++11.

The promises and challenges of std::async task-based parallelism in C++11

by Eli Bendersky

From the article:

"Task-based parallelism" refers to a higher level of abstraction, where the programmer manages "tasks" - chunks of work that has to be done, while the library (or language) presents an API to launch these tasks. It is then the library's job to launch threads, make sure there are not too few or too many of them, make sure the work is reasonably load-balanced, and so on. For better or worse, this gives the programmer less low-level control over the system, but also higher-level, more convenient and safer APIs to work with. Some will claim that this also leads to better performance, though this really depends on the application.

One of C++ most underrated features: Namespace aliases--Jonathan Müller

A nice story with a goal:

One of C++ most underrated features: Namespace aliases

by Jonathan Müller

From the article:

About two months ago I wrote the following r/cpp comment:

[compte supprimé]

  • You could always just alias the namespace like namespace fnc = FunctionalPlus.

foonathan

  • Namespace aliases are one of C++ most underrated features.

In the thread a new library was presented. One user complained about the long namespace name, (s)he got the above replies. Judging by the number of upvotes, people seemed to agree with my comment. In this blog post I am going to elaborate it...

Searching and replacing in strings with boost

My series on building applications with Qt an boost continues:

Searching and replacing in strings with boost

by Jens Weller

From the article:

The next big milestone for my CMS is to actually generate HTML files, and I'm almost there. I'll reach it in the next two weeks, most code is written, just a little bit of refactoring is needed. This blog post is about searching and replacing in strings. As I started last week with implementing the functionality, that turns the data in my CMS into an HTML website.

There needs to be a lot of text transformed, in order to turn a shared structure like a cross page layout into a single, special HTML file, one of those transformations is, to replace the internal links with the correct links. A link to a different page in the same website cannot be represented as a text link, instead it is represented by a linkid, which corresponds to the Page it points to. This is to have still the correct link, if the page is renamed or moved...