Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copyability of b2World and other classes #711

Closed
HolyBlackCat opened this issue Jan 8, 2022 · 2 comments
Closed

Copyability of b2World and other classes #711

HolyBlackCat opened this issue Jan 8, 2022 · 2 comments

Comments

@HolyBlackCat
Copy link

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).

@erincatto
Copy link
Owner

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.

@erincatto
Copy link
Owner

Just b2World for now. #736

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants