I've tried several solutions here but haven't landed on something that works for adding two std::vectors. I'm building out a game in C++ and I forward declare a fighter
variable here:
class Game {
public:
std::vector<Fighter*> fighter;
void AddFighter(Fighter* a);
Implementing AddFighter
, I need to take in a Fighter*
and add it to the std::vector<Fighter*> fighter
I declared. I've tried to add these vectors in a simple way like this:
void Game::AddFighter(Fighter* a) {
fighter* = fighter* + a;
}
As well as like this referencing Appending a vector to a vector:
fighter.insert(std::end(fighter), std::begin(a), std::end(a));
However I don't think Im understanding the syntax. How do I add these vectors?