I’m new to C++ so this is probably a very simple question, but I haven’t been able to find any examples online that have helped.
I’ve defined my own Bubble class and I need to create a vector/list (I’m used to C# and Java, so I’m not sure which is correct) to dynamically store Bubble objects in. Here’s my code so far:
#include "Bubble.h"
#include <vector>
#include <list>
int backgroundImages[10];
list<Bubble> bubbles;
vector<Bubble> bubbles_two;
Bubble b;
void AppMain()
{
loadImages();
ViewAdd(backgroundImages[8], 0,0);
b = Bubble();
b.velocity = Vector2D(9,4);
//I know this can't be right..
bubbles.add(b);
bubbles_two.add(b);
}
Neither the list nor the vector works – it says “list/vector is not a template” in my error list.
Which should I use, list or vector? And how do I correctly implement it?
The functions vector.add() and list.add() do not exist.
There are almost no obvious differences between the vector and the list, but functionally, there are.