std::endl writes a newline to the output stream and flushes it. In most cases, the developer doesn’t need to flush. Flushing operation is expensive, because it involves a system call. Instead of std::endl, you can simply write “\n”. …
In an application, sometimes we need faster processing. One of the many ways to achieve faster processing is by doing many things simultaneously. This is called parallelism. This can be done by creating multiple processes or multiple threads. We can call it an execution unit. An execution unit is assigned…
Sometimes we create an object which contains no valid data. We often a associate a flag or a special value, which decides the validity of the data. For example,
Often, a function will return multiple values packed in a structure. In good old C++ you need to assign it to a struct variable and access the individual members from there. In pre-C++17, however, you need to assign the return value to a struct variable and access the individual elements…
When a classes interacts with another class, a relationship develops between those two. This is called association. In an university, a student can learn from an instructor. We can model this relationship as follows.
The relationship can also show how many objects interact. This is called multiplicity. …
The model-view-delegate pattern is a variant of MVC pattern. The model has the data. The view is responsible for presenting data. Delegate is responsible for how data is presented. It basically decides how data is shown and modified.
In this article, I will write about ListModel and ListView.
Sometimes at some part of the program, we need to allocate some memory and later free it.
template <typename T, std::size_t N>
return new T[N];
}template <typename T>
void freeMemory(T *p)
int *p = allocateMemory<int, 10>()…
This is a question which I was asked in a senior software engineer position for a Berlin based company.
SOLID is a set of 5 principles, which is followed to make maintainable systems.
S — Single Responsible Principle
O — Open-Closed Principle
L — Liskov Substitution Principle
I — Interface…
Positioner items are container items that manage the positions of items in a declarative user interface. The items are arranged in a regular layout, like column, row or grid, etc.
In this article, we will discuss 4 different types of positioners.
Row item positioner positions the…