CppCon 2019 has ended
Back To Schedule
Thursday, September 19 • 16:45 - 17:45
C++ Class Natures in Their Canonical Form and How to Find Them

Log in to save this to your schedule, view media, leave feedback and see who's attending!

While working on guidelines for safety critical systems the author discovered that looking at the required special member functions and kind of member variables one can clearly distinguish several C++ class type natures. For example, there exist empty types, such as traits, or value types, such as std::string. But also types that manage resources, such as scope guards or unique managers, can be distinguished. A last area are object-oriented polymorphic base classes forming a separate nature. This categorization has direct influence on the applicability of the "Rule of Zero", "Rule of Five", or the author's "Rule of DesDeMovA". The nature of member variables influence the nature of the class embedding them.

This talk maps the landscape of class/type natures and how they influence directly or indirectly the way you specify or the compiler provides copy or move operations and a destructor. With that information you will get concrete guidelines to provide canonical class types more consciously with the least amount of code scaffolding. It also helps you to avoid creating easy to misuse types and gives guidance to encapsulate and hide "dirty tricks" that you might still need or want.

avatar for Peter Sommerlad

Peter Sommerlad

Professor, IFS Institute for Software
Prof. Peter Sommerlad is director of IFS Institute for Software at FHO/HSR Rapperswil, Switzerland. Peter is co-author of the books POSA Vol.1 and Security Patterns and contributed to "97 things every programmer should know". His goal is to make software simpler and safer by Decremental... Read More →

Thursday September 19, 2019 16:45 - 17:45
Crest 3

Attendees (48)