If I have a variable whose type was a template, and I want to create another variable of another template, but use the same template parameter, how can I?
While the example below does not work, it hopefully gives an idea of what I want to accomplish. If there is no particular way to do this, is there a way to create some sort of lookup table design template? There are only six different types of patterns that I probably end up using.
template<typename T>
class A{
public:
typedef T Type;
};
template<typename T>
class B{};
int main(void){
A<int> var1;
B<var1::Type> var2;
}
My apologies if this is a duplicate question, but I have not seen anything like it before.
EDIT
I would like this to work with Visual Studio 2010 and gcc without using a third-party library. Therefore, not all C ++ 11 features can be supported.
, typedef A<int> A<int>, , , . , , .