Skip to content
michael.caisse.io michael.caisse.io
c++ fundamentals

The Canonical Class

Exploring the boilerplate of a C++11 class including rvalue references, move semantics, perfect forwarding, explicit, noexcept, and initializer lists.

M

Michael Caisse

60 minutes

Event: cppcon

Abstract

How do you write a “simple” class? Do you include a swap? What does it mean to be movable? When should you use the noexcept specifier? What about member initializer lists?

This session explores the boilerplate of a C++11 class, covering rvalue references, move semantics, perfect forwarding, explicit, noexcept, and initializer lists. We will examine each element of the canonical class to understand when and why each piece is needed.

Play the video