Can I do it?
I have a macro DYNAMIC_CLASS, the general usage is:
#define DYNAMIC_CLASS(className) className u,v; u=v;
Class Point
{
public:
Point() {};
}
int main()
{
DYNAMIC_CLASS(Point);
}
Now my problem is a little complexity, I want pass clasName definition in a template function, like this:
template<T> doMore(T t)
{
DYNAMIC_CLASS(T);
}
int main()
{
Point p;
doMore(p);
}
I expect that in doMore() the C++ compiler expanding the macro to DYNAMIC_CLASS(Point). However, it is not the case, it always expands to DYNAMIC_CLASS(T).
Could you show me the light at the end of the tunnel for my problem? Cheers
Aucun commentaire:
Enregistrer un commentaire