resource manager

im trying to make a resource class in my game, but how can i template or template-like a map?

1
2
3
4
5
6
7
8
class Resource
{
   public:
         template<typename T> T& getResource(const std::string);
   private:
         template<typename T> std::map<std::string,T>resource_map//illegal,any //sub solution?

}
Last edited on
Does it work if you do this?
1
2
3
4
5
6
7
8
template <class T>
class Resource
{
    public:
        T& getResource(const std::string);
    private:
        std::map<std::string,T> resource_map;
}
@shadowmouse


thanks,
can you help me about this?
1
2

template<typename T> Resource* Resource<T>::pResource = nullptr;


Error:

invalid use of template-name 'Resource' without an argument list|


im still weak in templates syntax
Topic archived. No new replies allowed.