コンパイル時に派生型に基づいてクラスのハッシュを生成したいと考えています。今日、私はそれを次のように生成します:
template<class Type>
class TypeBase
{
public:
static const unsigned s_kID;
};
template<class Type>
const unsigned TypeBase<Type>::s_kID = hash(typeid(Type));
しかし、これは(かなり不必要に)ランタイム初期化コードを生成します( hash(..) 関数は std::type_info::name() に基づいて単純なハッシュを行います)
アイデア?