I am new to C ++, so this is probably a very simple question, but I could not find any examples that helped.
I have 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 if this is correct) to dynamically store Bubble objects. Here is my code:
#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 list nor vector works — it says “list / vector is not a template” in my error list.
What should I use, list or vector ? And how to implement it correctly?
Cbas
source share