Template metaprogram converting type to unique number

Posted by daramarak on Stack Overflow See other posts from Stack Overflow or by daramarak
Published on 2009-11-10T14:43:09Z Indexed on 2010/03/21 5:51 UTC
Read the original article Hit count: 308

Filed under:
|
|

I just started playing with metaprogramming and I am working on different tasks just to explore the domain. One of these was to generate a unique integer and map it to type, like below:

int myInt = TypeInt<AClass>::value;

I want to know if this is at all possible, and in that case how. Because although I have learned much about exploring this subject I still have failed to come up with an answer.

(P.S. A yes/no answer is much more gratifying than a c++ solution that doesn't use metaprogramming, as this is the domain that I am exploring)

© Stack Overflow or respective owner

Related posts about c++

Related posts about metaprogramming