Page MenuHomeWildfire Games

Simple refactoring of Singleton
ClosedPublic

Authored by vladislavbelov on Jun 5 2018, 2:36 AM.

Details

Reviewers
wraitii
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Commits
rP22050: Simple refactoring of Singleton. Make it non-copyable.
Summary

Singletons should be NONCOPYABLE by default.

Test Plan
  1. Apply the patch and compile the game.
  2. Run tests and makes sure that the number of passed tests is the same.

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

vladislavbelov created this revision.Jun 5 2018, 2:36 AM
vladislavbelov added inline comments.Jun 5 2018, 2:38 AM
source/lib/code_annotation.h
219 ↗(On Diff #6724)

By C++ refs the valid assign operator is:

T& operator=(const T&) = delete;
Vulcan added a subscriber: Vulcan.Jun 5 2018, 3:11 AM

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/differential/629/display/redirect

Vulcan added a comment.Jun 5 2018, 3:45 AM

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/differential/630/display/redirect

Stan added a subscriber: Stan.Dec 28 2018, 5:21 PM

Just tested, in Debug and Release build, all tests passed.

The patch does not change logic AFAICS so it should be pretty safe. In any case, if someone tried to use singletons incorrectly it should not compile, nor crash.

wraitii accepted this revision.Jan 7 2019, 9:00 PM
wraitii added a subscriber: wraitii.

Bump years before committing but this compiles and is nice.

This revision is now accepted and ready to land.Jan 7 2019, 9:00 PM
This revision was automatically updated to reflect the committed changes.