microsoft / DirectXMesh

DirectXMesh geometry processing library
https://walbourn.github.io/directxmesh/
MIT License
787 stars 151 forks source link

Follow the Rule Of Zero in VBReader and VBWriter classes #61

Closed danielkrupinski closed 3 years ago

danielkrupinski commented 3 years ago

Member std::unique_ptr already takes care of resource management. https://en.cppreference.com/w/cpp/language/rule_of_three#Rule_of_zero

walbourn commented 3 years ago

Remember that this is using the pImpl idiom. The private class Impl is completely opaque to client code, so the compiler can't create a default move ctor or move operator in the client code. The only place that has that information is inside the implementation .cpp.

I suspect this code builds find in the library, but have you tried consuming it from just the public header? The test suite can be found here.

danielkrupinski commented 3 years ago

You're right, I missed that. The tests don't check movability of the objects, therefore they failed to compile only because of destructor using an incomplete type. Anyway, those special members seem to be fine being defaulted in .cpp, so I will open another pull request implementing that.