Hi,
I'm wondering if it is possible to define typedef template? For
example, I have template class A. I want give it an alias such as B.
The problem comes from refactoring the code. Suppost A is not a
template class. After refactoring, I decide to add a template
parameter to it.
But the original following code need to be updated as well.
typedef A B;
However, I don't find any easy way to change such code.
Thanks,
Peng
#include <iostream>
template <typename T>
class A {
public:
A() : _a(10.5) { }
T the_a() const { return _a; }
private:
T _a;
};
typedef int T;
template <typename T>
typedef A<TB; // want to define a typedef for a class template
int main() {
T t(10);
std::cout << t << std::endl;
A_T<inta(10);
std::cout << a.the_a() << std::endl;
}