Sane and safe C++ class types

Speaker: Peter Sommerlad

Audience level: Beginner | Intermediate

category

C++ is a complex language and with the introduction of move semantics, noexcept and constexpr in C++11 and later, defining or declaring the right combination of magic keywords in the right place is daunting for the uninitiated.

There is the Rule of Zero telling that you should let the compiler figure out what to provide. It carries far for the application level programmer, but still might not be sufficient. Should you then rely on the Rule of Five or Six? What would be the consequences? When should you actually deviate from the Rule of Zero.

For example, classes representing values should better not have virtual member functions. But should you use final or not? Do you really need class hierarchies?

Many C++ guidelines try to limit the use of the language features so that resulting code has higher chances to be correct and safe. This talk will give an overview of the kind of classes you can create in such a controlled setting and provides a map to where is expert territory that requires deliberate care about your classes.

The talk will further provide guidelines for how to circumvent expert territory and how to step there without shooting yourself in the foot or tripping a mine.