(I told you, I don't get along with templates)
Here's my code:
#ifndef INSTANCELOCATOR_INCLUDED#define INSTANCELOCATOR_INCLUDED#include <vector>namespace Utils { template <typename T> class TInstanceLocator { private: static std::vector <T*> Instances; public: TInstanceLocator ( void ) { Instances.push_back(static_cast <T*> ( this )); printf("Added instance of %s (%X)\r\n",typeid(T).name(), this); } ~TInstanceLocator ( void ) { } T GetInstance(unsigned In_Index) { return Instances[In_Index]; } }; }#endif
I get an unresolved external symbol whenever i insert the push_back line. What's up with this?
Basically, this will be something like a singleton template class, but with multiple objects. Just to be able to acess all of the instantiated objects of a certain type :D
Thanks,
[Edited by - ApochPiQ on July 19, 2010 1:18:51 PM]