Resource Management question..
Really I just want to know which would be safer... or if one or both has a major pitfall.
Code:
namespace Varia
{
class ResourceMgr
{
public:
ResourceMgr();
~ResourceMgr();
void AddResource(const char* p_scriptFile);
void DeleteResource(int p_index);
private:
std::vector<Resource*> Resources;
};
};
or
the same thing but using std::map instead of vector.
I was thinking that if you delete a resource in a vector then every index after the deleted resource would change. Although with the map the index would remain the same with deleting a certain resource. Really I am wondering what would be the downfalls to either approach. I know the classes are not complete, but hopefully I got the point across.