erincatto / box2d

Box2D is a 2D physics engine for games

Home Page:https://box2d.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Copyability of `b2World` and other classes

HolyBlackCat opened this issue · comments

commented

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 =deleted (or made private if you're supporting pre-C++11), but if yes, they should be =defaulted 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