Copyability of `b2World` and other classes
HolyBlackCat opened this issue · comments
This is a rather minor issue.
I accidentally tried to copy an instance of b2World
, and got a warning from Clang (from -Wdeprecated
):
b2_world.h:54:2: warning: definition of implicit copy constructor for 'b2World' is deprecated because it has a user-provided destructor [-Wdeprecated-copy-with-user-provided-dtor]
Is it supposed to be copyable? I think not, so the copy operations should be =delete
d (or made private if you're supporting pre-C++11), but if yes, they should be =default
ed to silence the warning.
The same applies to all other classes with custom destructors.
If you agree with the fix, I can make a PR (I just need to know if I should target C++98 or >=C++11).
Box2D was mostly written before C++11, but I have started adding some C++11 keywords when it makes sense. This seems like a good change. b2World
is definitely not designed to be copied.
Just b2World
for now. #736