The big three is a C++ resource-management guideline: when a class defines a destructor, copy constructor, or copy assignment operator, it will generally need to define all three. Special handling for one operation usually means the other two need corresponding resource behavior. section 6.1.4
The guideline concerns these special member functions:
- Destructor: releases or otherwise manages the owned resource. section 6.1.4
- Copy constructor: defines how a copied object obtains an appropriate resource. section 6.1.4
- Copy assignment operator: defines how assignment replaces or shares the resource safely. section 6.1.4
- Since C++11, also consider move construction and move assignment; otherwise containers may lose move-based optimization opportunities. section 6.1.4
Listing 6.10 Type traits to check for special member functions
#include <type_traits>
void check_properties()
{
... #1
static_assert(
!std::is_default_constructible_v<Race::Blob>
); #2
static_assert(
std::is_destructible_v<Race::Blob>
); #2
static_assert(
!std::is_copy_constructible_v<Race::Blob>
); #2
static_assert(
!std::is_copy_assignable_v<Race::Blob>
); #2
static_assert(
!std::is_move_constructible_v<Race::Blob>
); #2
static_assert(
!std::is_move_assignable_v<Race::Blob>
); #2
static_assert(
std::has_virtual_destructor_v<Race::Blob>
); #3
}
Inspect compile-time checks for whether a type is destructible, copyable, movable, or constructible. section 6.1.4


