K
kuangye
#include <iostream>
using namespace std;
template<const int i1>
class TC
{
public:
void fn()
{
cout<<"i1 "<<i1<<endl;
}
};
const int gck = 0;
#define TC<gck> DTC;//error,why?.........................
//...................
//any other solution for this except for typedef
//typedef TC<gck> DTC;//ok
void try1()
{
DTC obj1;
obj1.fn();
{
const int gck = 1;
DTC obj1;
obj1.fn();
}
}
int main()
{
try1();
return 1;
}
using namespace std;
template<const int i1>
class TC
{
public:
void fn()
{
cout<<"i1 "<<i1<<endl;
}
};
const int gck = 0;
#define TC<gck> DTC;//error,why?.........................
//...................
//any other solution for this except for typedef
//typedef TC<gck> DTC;//ok
void try1()
{
DTC obj1;
obj1.fn();
{
const int gck = 1;
DTC obj1;
obj1.fn();
}
}
int main()
{
try1();
return 1;
}