I'm trying to copy another class' vector to cActionPuppet with the following code.
(I apologize for any formatting issues, for some reason, the site won't let me use the formatting tools)
1. Is ActionMove an object-oriented type (ie. a run-time polymorphic type, ie. a class with virtual functions)?
If the answer to 1. is yes,
2. How does one make a copy of the actual object pointed to by a std::unique_ptr<ActionMove>?
(Note that the dynamic type of the object may be a derived type of ActionMove.)
If the answer to 1. is no,
2. Why is a vector of pointers required? Why not a vector of values std::vector<ActionMove>?
> If the answer to 1. is yes,
2. How does one make a copy of the actual object pointed to by a std::unique_ptr<ActionMove>?
(Note that the dynamic type of the object may be a derived type of ActionMove.)
I use a function called dumpLog() for my player, where mActionMoveLog is a vector of all of his logged actions.
std::unique_ptr<> implements sole ownership semantics. That means that there can't be two std::unique_ptr<>s pointing to the same object.
If a copy of a vector of pointers is to be made, either:
a. use the smart pointer with shared ownership semantics - std::shared_ptr<> - instead of std::unique_ptr<>, and then copy the vector of shared pointers (like in the constructor)