There were a lot of C++ experts who said that smart pointers were the most important feature of C++11. Today, I will write about smart pointers in C++.
The guidelines has six rules for explicit memory allocation and deallocation. Six! Maybe you are surprised because there is a simple rule in modern C++: don't use new and delete. Obviously, the story is not so simple.
This and the next posts will probably be about the most important concern in programming: resource management. The C++ Core Guidelines has rules for resource management in general but also rules for allocation and deallocation and smart pointers in particular. Today I will begin with the general rules of resource management.
The section to enumerations has eight rules. Since C++11, we have scoped enumerations which overcome a lot of the drawbacks of classical enumerations.
A union is a special data type where all members start at the same address. A union can hold only one type at a time; therefore, you can save memory. A tagged union is a union which keeps track of its types.
I started in the last post my journey through the rules for overloading of functions and operators. Let me continue and finish my journey with this post.
There are ten rules for overloading and overload operators in the C++ core guidelines. Lots of them are quite obvious but if you don't follow them, your software may become very unintuitive.
There are nine rules to access objects in class hierarchies. Let's have a closer look.
I needed three posts to present the 20 rules for class hierarchies in the C++ core guidelines. Here are the seven remaining rules.
In the last post, I started our journey with the rules to class hierarchies in modern C++. The first rules had a quite general focus. This time, I will continue our journey. Now, the rules have a closer focus.
Currently are 137 guests and no members online
Kubik-Rubik Joomla! Extensions