1 #ifndef SAUCE_INTERNAL_TYPE_ID_H_
2 #define SAUCE_INTERNAL_TYPE_ID_H_
8 #include <sauce/exceptions.h>
23 typedef void (*TypeSignature)();
28 template<
typename Type>
29 void TypeSignatureFactory() {}
35 TypeSignature signature;
42 explicit TypeId(TypeSignature
const & signature):
43 signature(signature) {}
49 bool operator==(
TypeId const &
id)
const {
50 return signature ==
id.signature;
53 bool operator!=(
TypeId const &
id)
const {
54 return signature !=
id.signature;
57 bool operator<(
TypeId const &
id)
const {
58 return signature <
id.signature;
69 template<
typename Type>
75 template<
typename Type>
77 friend TypeId typeIdOf<Type>();
80 TypeId(&TypeSignatureFactory<Type>) {}
92 template<
typename Type>
94 return ResolvedTypeId<Type>();
100 typedef std::pair<TypeId, std::string> NamedTypeId;
105 template<
typename Type>
106 NamedTypeId namedTypeIdOf(std::string
const name) {
107 return std::make_pair(typeIdOf<Type>(), name);
113 typedef std::set<NamedTypeId> TypeIds;
117 namespace i = ::sauce::internal;
121 #endif // SAUCE_INTERNAL_TYPE_ID_H_