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

Hello, I have a question in Chapter 6 RoboCatRTS #7

Closed
insooneelife opened this issue Jul 10, 2016 · 1 comment
Closed

Hello, I have a question in Chapter 6 RoboCatRTS #7

insooneelife opened this issue Jul 10, 2016 · 1 comment

Comments

@insooneelife
Copy link

Hello, I have a question in Chapter 6 RoboCatRTS.
In class CommandList, there is no copy constructor defined.
But in class TurnData, it calls copy constructor of CommandList in TurnData's main constructor.
I don't understand the intend for this code.
Is there some kind of life cycle issue about CommandList?

@chalonverse
Copy link
Contributor

Even though a copy constructor isn't defined in CommandList, there's going to be a default copy constructor provided by C++ that would invoke a copy of the deque member variable.

The reason why the TurnData makes a copy of the CommandList is because the input manager has only one CommandList that is reused for every turn. But all of the previous turn data is saved, so if the code didn't make a copy that would be lost.

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

No branches or pull requests

2 participants