Qt Value Class Design
summary
Classifies value classes into thin, thick and pimpled designs and gives concrete rules: mark types with Q_DECLARE_TYPEINFO, implement matching QHash and equality consistency, avoid fuzzy-compare equality for hashable types, prefer noexcept member swap plus a namespace swap picked up by QSwap/ADL, and note Qt 5.6 container move-assignment semantics and ongoing smart-pointer work so pimpled types can have inline moves. Lots of examples of broken code, binary-compat pitfalls from exporting non-polymorphic classes, and a pointer to a longer Meeting C++ talk for the full designs.
AI-written summary · about
chapters (12)
- 0:00Introduction and overview
- 1:09Types of classes in Qt
- 4:42Thin and thick abstractions
- 6:33Qt features for value classes
- 11:51Q_DECLARE_TYPE_INFO and Qash
- 16:37Consistent hash functions
- 18:03Q_REQUIRED_RESULT and move semantics
- 20:29QSwap and ADL
- 21:53Exporting non-polymorphic classes
- 24:25Binary compatibility pitfalls
- 25:50Compiler attributes in Qt
- 27:39Summary and Q&A
related talks
01h 20mWhat Classes We Design and How
30mThe building blocks of QML, and how to use it with C++
01h 04m“Sane and Safe C++ Classes”
58mModern C++ Design (part 2 of 2)
01h 17mGetting Started - a Qt fast track 2/4 - A Core Module
56mIdentifying Common Code Smells
25mBest Practices for using QML and QtQuick
59mThe Most Valuable Values
