Unless you are an experienced library writer you should think very, very hard about writing copy or move constructors (and even then, think again).
Unless you are an experienced library writer you should think very, very hard about writing copy or move constructors (and even then, think again).
Yeah, so USE std::string in your classes, then no copy constructors written by you will be needed. If you find yourself heap-allocating things explicitly with "new", then you are almost certainly doing something wrong.
Why does it matter who wrote the copy constructor? In the author's example, they did not write a copy constructor, they USEd std::string.
This matters in high-performance scenarios. The fact that you can introduce a performance issue simply by creating a temporary is absolutely bonkers, and makes writing high-performance code more complicated than it needs to be (and god knows it's already very complicated).
The article links out to Compiler Explorer (https://godbolt.org/), which shows the exact compiler version and options and lets you play with different ones. It shouldn’t matter which compiler — the standard prohibits optimizing this.