I have a texture manager that I am running as singleton, and wish to make a objectmanger in the same way..
Anyway.. I copied the EAXACT code that is working 100% in the texturemanager but in the object manager it is giving me this error “Non Static Member Reference mush be relative to specific object”
I assume it has something to do with the std::map?
Here is my 100% working textureManager header and cpp file.
http://ideone.com/6bZQG | http://ideone.com/jjo2M
Here is the start of the ObjectManager that is NOT working…
http://ideone.com/rhSim | http://ideone.com/uLj4X
Now, basically the pointer to std::map is where I am getting the error.. (line 23 of ObjectManager.cpp) The delete call in destroy() is giving me that error and anywhere else (if I make a new function. Yet the timer variable is working as expected.
Is there some fancy way I am supposed to do a pointer to a std::map? As far as i can tell this code is 100% the same as the code for the texture manager?
Thanks for any advise!
To roughly repeat what I said on IRC:
std::map— it does not save you any copies, and will likely cost more memory and effort to maintain.unique_ptrfor them: see header and implementation.As to why your version was not working: on line 23 of your implementation file, you were referring to
gameObjectswithout specifying which instance you meant. You probably meantinstance->gameObjects.