Weird error when compiling.
TheFlyingFiddle
theflyingfiddle at gmail.com
Sat Oct 19 18:56:38 PDT 2013
> public class ComponentDetail(T) : Component {
>
> ////////////////////////////////////////////////////////////
> /// Component's ID as static member.
> public static hash_t ID = typeid(T).toHash;
typeid(T).toHash can not be evaluated by the compiler at
compile-time.
Placing the ID initalization in a static this should fix the
problem.
eg.
public static hash_t ID;
static this()
{
ID = typeid(T).toHash;
}
More information about the Digitalmars-d-learn
mailing list