
David Gruener wrote:
I'm not sure what this utility is trying to address. The motivation is not to write down constructor, destructor, assignment operator and so on. But, unfortunately, you have to. Why do you think that? No, you don't have to write a constructor, destructor, or an assigment operator for the pimpl_ptr to work. Please look at the example/default.cpp file.
Smart pointer or not, with a pimpl, the implicit generated versions of these operations are all wrong, because the compiler only has a forward declaration to the hidden class and therefore can't create, destroy and compare it. Again, I don't know why you think this it true - unless I'm missing something. When constructed/destructed the T type isn't undefined since it's defined in the cpp file. That's the fact I've build this library on top of.
Even with some smart pointer you have to write down those operations, while leaving the function bodies in the cpp file empty. Still I don't agree with you. Do you have an example to showcase this?
Regards, Asger