Can I set defaults in template parameters to depend on other parameters? This is what I'm trying to do:
The KeyType and Hash should be changable to other classes, but I want the default to be RsrcType::Hash, for example. So, if I say:Code:
template <typename RsrcType, typename KeyType = RsrcType::KeyType, typename HashType = RsrcType::Hash>
Then KeyType = MyClass::KeyType.Code:
This is giving compiler errors right now...
(One for KeyType too.)Code:
rsrc_cache.h:64: error: ` RsrcType::Hash' is not a type
I could always leave the last two with no defaults, but it means more typing, and the last two are fairly dependent (KeyType moreso than Hash) on RsrcType, so the default would be nice. (I have a couple of "RsrcType" classes for different types of resources that contain subclasses of KeyType and Hash.)