Is possible to generate constant value during compilation?

Posted by AOI Karasu on Stack Overflow See other posts from Stack Overflow or by AOI Karasu
Published on 2010-06-14T20:19:34Z Indexed on 2010/06/14 20:22 UTC
Read the original article Hit count: 207

I would like my classes to be identified each type by an unique hash code. But I don't want these hashed to be generated every time a method, eg. int GetHashCode(), is invoked during runtime. I'd like to use already generated constants and I was hoping there is a way to make the compiler do some come computing and set these constants. Can it be done using templates? Could you give me some example, if it is possible.

© Stack Overflow or respective owner

Related posts about c++

Related posts about visual-studio-2008