April 2014

Qt & JSON

Recently I could play around with Qt5 JSON API:

Qt & JSON

by Jens Weller

From the Article:

With Qt5 there is a new API for reading and writing JSON files in Qt. In the last days I had the chance to play around with this API, as I implemented importing and exporting different data sets from and to JSON.

Quick Q: Are class member initializers evaluated at compile time? -- StackOverflow

Quick A: Maybe.

Recently on SO:

Does in class member initialization takes place at compile time or run-time?

In C++11 a new feature was introduced where the programmer can initialize class member variables inside class's definition, see code below:

struct foo
{
  int size = 3;
  int id   = 1;
  int type = 2;
  unsigned char data[3] = {'1', '2', '3'};
};

Is this initialization takes place during compile time or this feature is just syntactic sugar and member variables are initialized in the default constructor?

Nugget: Context-sensitive keywords -- Tony DaSilva

Recently on Bulldozer00:

Context Sensitive Keywords

by Tony DaSilva

From the article:

With the seriousness of keyword introduction in mind, one might wonder why the override and final keywords were added to C++11. Surely, they’re so common that millions of lines of C/C++ legacy code will get broken. D’oh!

But wait! To severely limit code-breakage, the override and final keywords are defined to be context sensitive...

Range Comprehensions -- Eric Niebler

Do you "comprehend" ranges? From a key participant in some of the latest discussion about ranges for C++:

Range Comprehensions

by Eric Niebler

From the article:

I’ve been busy since I last wrote about ranges. I have a lot of news to share, but in this post, I’m going to narrowly focus on a recent development that has me very excited. It’s a new feature that I’m calling range comprehensions, and they promise to greatly simplify the business of creating custom ranges...

noexcept: what for? -- Andrzej KrzemieĊ„ski

From the desk of Andrzej:

noexcept -- what for?

by Andrzej Krzemieński

From the article:

In this post I would like to share my observation on where using noexcept really adds value. It is less often than what one might expect, and it does not have that much to do with throwing or not throwing exceptions. The conclusion surprises me a bit, and I hesitate to present it because it is counter to the advice I hear from people I consider authorities on the subject...

Async-Await in C++ -- Paolo Severini

severini-await.PNGParis, April 2014: Paolo Severini explores the Async-Await pattern and the related proposal for C++17, showing also an example by using Visual Studio 2013 November CTP.

Async-Await in C++

by Paolo Severini

From the article:

... what about native [C++] programming? Is there anything like async/await that we can use with our futures? We can find the answer in N3858, another proposal made by Gustafsson et al. for C++17.

This time the changes proposed are to the language itself and not just to the library. The idea is to introduce the equivalent of C# async methods in the form of resumable functions. They can be thought as the basis to add to C++ the support for real co-routines, and are not strictly related to the <future> library, even though they have being defined especially to improve the usability of futures and promises...

Announcing the student program for Meeting C++ 2014

Today I have the honor to announce the details of this years student program for Meeting C++ 2014

Meeting C++ 2014: the student program

by Jens Weller

From the article:

The Meeting C++ Student program will enable 50 students to attend Meeting C++ 2014 plus 3 exclusive workshops organized by think-cell one day before the conference on December 4th. So, for students this will be a 3 day conference! After the workshops you will be invited to the student dinner by think-cell.

Writing a simple bar graph widget in Qt

Recently I had to implement a simple version of a bar graph widget in Qt:

Writing a bar graph widget in Qt

by Jens Weller

From the Article:

Today I had a little fun with Qt and wrote a widget for displaying a bar graph. I have two different situations where I need the bar graph in my back end: displaying the votes a single talk got, and displaying one big bar graph of all the talks.

Preferring STL algorithms from algorithm and numeric -- makramkd

(Related note: If you haven't yet watched and grokked Sean Parent's wonderful C++ Seasoning talk from last fall's GoingNative conference, do yourself a favor and watch it. You will find it eye-opening. If you have already watched it, you might still find it worth a re-watch to fully absorb.)

Here's a nice case study of why not to roll your own algorithms, when C++ comes with a treasure chest full of pre-written, pre-debugged, and pre-optimized (in a good way) standard algorithms in the box:

Preferring STL algorithms from algorithm and numeric

by makramkd

From the article:

This post isn’t meant to be a documentation of the algorithm and numeric headers: you can find those readily at cppreference. In this post I’m going to try to convince people that write very similar algorithms to those in the standard library to not use these algorithms in production code, and to prefer ones from the STL.

Let’s get the show on the road. I’m going to start with the most simple one, because I just want to get my point across.