On May 31, 2016, at 9:51 PM, Vladimir Batov
On 2016-06-01 11:08, Howard Hinnant wrote:
... It has to be outlined, in the source.cpp: ... Book::~Book() = default; Book::Book() = default;
Uh, yes, indeed. I got it now. I'll adjust the wording in the docs.
Excellent, thanks.
Somewhat off the topic.
From efficiency point of view the above is identical to
Book::~Book() {}
or compiler writers do more magic with "=default"? I like "=default" as I feel it's cleaner language-wise. What weighty reason can I give to a beginner to prefer "=default" over {}... apart from "I am older, musclier and your boss" :-)
That’s a good question. It doesn’t turn the destructor from non-trivial to trivial. It does not change the noexcept or constexpr status. The only thing it really does is say: I want default semantics here. Maintenance programmers should be more leery of adding superfluous stuff to your destructor. Howard