A simple class for tracking pointers to elements (intended to be used for cross-refencing classes wth various id's)
Initialized as Tracker<T>
where T is the type you want to store pointers of
Add new elements
Tracker<int> tracker;
int* intptr = new int[42];
uint intptr_id = tracker.add(intptr);
//-------------or-------------
uint intptr_id = tracker(intptr);
Retrieve elements
/*
get items (thread safe but does not check if id is out of range)
returns NULL if id is in range and unused
range is the same as the highest allocated id == size()-1
*/
int* intptr = tracker.get(inptr_id);
//-------------or-------------
int* intptr = tracker[intptr_id];
/*
get items (thread safe and returns NULL if id is out of range/unused)
*/
int* intptr = tracker.get_safe(inptr_id);
/*
get items (no thread safety or range checks)
*/
int* intptr = tracker.get_unsafe(inptr_id);