//https://philippegroarke.com/posts/2018/easy_defensive_programming/ //http://www.modernescpp.com/index.php/c-core-guidelines-regular-and-semiregular-typs template constexpr bool fulfills_rule_of_5() { static_assert(std::is_destructible_v, "T : must be destructible"); static_assert(std::is_copy_constructible_v, "T : must be copy constructible"); static_assert(std::is_move_constructible_v, "T : must be move constructible"); static_assert(std::is_copy_assignable_v, "T : must be copy assignable"); static_assert(std::is_move_assignable_v, "T : must be move assignable"); return std::is_destructible_v && std::is_copy_constructible_v && std::is_move_constructible_v && std::is_copy_assignable_v && std::is_move_assignable_v; } struct the_mighty_potato { the_mighty_potato(int some_number, int mul) : carbs(some_number * mul) {} int carbs{ 42 }; std::unique_ptr calories{ nullptr }; }; static_assert(fulfills_rule_of_5(), "the_might_potato: must fulfill rule of 5"); // Fails