Boost logo

Boost :

Subject: Re: [boost] Pimpl Again?
From: Howard Hinnant (howard.hinnant_at_[hidden])
Date: 2016-05-31 21:57:32


On May 31, 2016, at 9:51 PM, Vladimir Batov <Vladimir.Batov_at_[hidden]> wrote:
>
> 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




Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk