For example, here is some code:
template <typename T, typename Id, typename Container>
struct ResHelper {
//some code
Id m_resourceId;
ResourceManager<T, Id, Container> * m_manager;
RefCountPtrRoot<T, ResHelper<T, Id, Container> >* m_root;
};
template <typename T, typename Id = uint64_t, typename Container = std::map<Id, ResourceInfo> >
class ResourceManager {
//code goes here
};
I would really like to write it more like this:
template <typename Id>
struct ResHelper {
//some code
Id m_resourceId;
ResourceManager<?, Id, ?> * m_manager;
RefCountPtrRoot<?, ResHelper<Id> >* m_root;
};
template <typename T, typename Id = uint64_t, typename Container = std::map<Id, ResourceInfo> >
class ResourceManager {
//code goes here
};
Here I'm avoiding other template arguments because this is a struct that holds an id with some variable type.
The rest are just pointers. I put question marks in places where a type would normally go for that class.
So far the only way I can get my code to compile is to do it the way I did it above. This gets really annoying and messy when I have dependancies all over the place and end up needing classes that had very simple template arguments suddenly need like 6 template arguments because they have all these pointers.
I had a class before that contained a ResHelper<typename Id> but after doing some work now it needs to be ResHelper<typename T, typename Id, typename Container>. Now the templated class that contains the ResHelper<> needs to also provide template arguments for these extra things.