It seems that in C++ there is nothing easier than a constructor and destructor. But some interesting things can make your life better if you keep them in mind when you write the code.
In this talk, we will consider some of the tricks and hooks in coding, as well as broad themes, such as type design.
For example, what's the difference between a privately declared and a deleted constructor? (Spoiler: none.)
We will also discuss:
- 0/3/5 rules;
- constexpr constructors;
- explicit and strong typing;
- copy/move and equivalence;
- destructors are now noexcept and when destructors can still throw exceptions;
- virtual destructors and polymorphism;
- and some other things.