Let me rephrase my problem for those who need clarification.
I want a different feature set per project. Every time I want another set of
features, I have to derive from a filter object and override similar code, which is messy and tedious. I may also have some of the code for what I want written already, but I would have to invoke parent implementations to get it, or copy code from other projects.
All the filter methods can be generalized into policies. Consequently, I need one policy for each method. I would have a huge template argument list!
To use the host class, I pass it to object methods. The problem is, I have to tack template-templates onto the objects I'm passing it to. I
don't want to do that. The resulting code would become confusing (picture 10+ template templates following you to every working object of your library). I want to write preset policies that do several enumeration jobs to begin with, and the user can just browse through and build a new filter like a Lego set.
In short, I want to pass a templated host class around and I do NOT want every object I pass it to to be aware it's templated.
Nullsquared had the idea closest to what I was looking for, although I admit I don't fully understand how to implement it. It sounds like a modified Pimpl.
Quote:As for your actual problem, you can do something very similar. Have a non-templated BarBase interface that is passed to the function as a reference. The actual type that is passed can then be Bar<A, B> or whatever you user wants to use.
[Edited by - zyrolasting on March 4, 2010 6:48:53 AM]