I don't really understand what you try to do, but templates is something quite general. You can do cool things with them, but you are "limitated" with the programing freedom in them.
I wrote time ago an article expanding a very cool template of Simon Hughe.
The template is MFC based, but I think it can help you to have an idea and maybe understand some concepts.
The link is:
An Addition to Smart List classes[
^]
You really can compare types, but I would not recommend you to make a lot of conditional things in there. Templates should stay as simple as possible to be as flexible as needed
Hope it helps :)
Edit 01 (after deleted comment and non-solution update)
That is what I was saying before. I don't think that is a good idea.
The template can handle complexe TYPEs for you (if you read my article, you can have a look to the message board to see what I mean)
I don't see why it would be needed to declare different variables into the template. In my opinion, such kind of logic should be outside in your program.
You should create the template in a way that can handle everything, and depending on what you need then you pass one thing or another.
In my tesis I had 3 different set of objects, each one with different data structure and different parameters, variables and methods; but the template was only one and it worked with all of them.