The rule of zero, or six, is one of the advanced rules in modern C++. I wrote in my current book "C++ Core Guidelines Explained: Best Practices for Modern C++" about them. Today, I want to quote the relevant parts of my book in this post.
static_assert allows you to check at compile time if a type T fulfills the Concept: static_assert(Concept<T>).
The rules for copy and move are pretty obvious. But before I describe them I have to write about the two remaining rules for constructors. They are about delegating and inheriting constructors.
This post is about the rule of zero, five, or maybe six. I will also show the difference between copy and reference semantics and a quite similar topic: deep versus shallow copy.
Currently are 183 guests and no members online
Kubik-Rubik Joomla! Extensions