Hello,
I am currently working on a service provider which will hold instances of classes such as the renderer and the state manager which all derive from the Service class. To do so I though I could use templating.
Broken header file:
#include <map>
#include "Service.h"
class ServiceProvider
{
public:
// Methods.
template<class Type>
void AddService(Type type, Service* service);
template <class Type>
Service* GetService(Type type);
private:
// Globals.
map<class type, Service*> services;
};
I want to be able to store all these services in the map with the type as the key so I can do GetService<StateManager> for example. Is it possible to template member attributes this way?
Thanks!