Is there a way to create a std::vector
like list, but which only contains 1 value, without a key.
What I basically want to do is store a whole bunch of Entities. Also it'd be nice if I could remove objects by key. (e.g. map::remove(Entity*);
)
Yes. It is called std::set
. It is a set of values of a certain type.
For example:
std::set<int>
will store int
s.std::set<Entity>
will store Entity
objects (instances of the type Entity
).std::set<Entity *>
will store pointers to Entity.I assume you mean std::map
, not std::vector
?
In that case you could use a std::set
or std::unordered_set