Public Member Functions

 TypeId (TypeId const &other)=default
 
TypeIdoperator= (TypeId const &other)=default
 
bool operator== (TypeId const &other) const
 
bool operator!= (TypeId const &other) const
 
 TypeId ()
 

Static Public Member Functions

template<typename T >
static TypeId create () noexcept
 

Detailed Description

Normally when RTTI is used compiler will generate type information for every possible type in program - this can introduce huge binary bloat. TypeId class in oposition allow you to compare types in runtime only with marginal overhead and only for types which are really needed. This technique is well known and used in many serious projects - for example in LLVM. Most important trick is create() method, rest is just syntactic sugar.

Constructor & Destructor Documentation

rili::TypeId::TypeId ( TypeId const &  other)
default

copy constructor

Parameters
otherTypeId object
rili::TypeId::TypeId ( )
inline

TypeId default constructor constructs invalid TypeId (no real type can have equal TypeId)

Member Function Documentation

template<typename T >
static TypeId rili::TypeId::create ( )
inlinestaticnoexcept

create rili::TypeId instance for given, known in compile time type.

Returns
TypeId object instance for given in template Parameter type.
bool rili::TypeId::operator!= ( TypeId const &  other) const
inline

compare operator

Parameters
otherTypeId object
Returns
false if other was created for the same type, otherwise true
TypeId& rili::TypeId::operator= ( TypeId const &  other)
default

copy assigment operator

Parameters
otherTypeId object
Returns
reference pointing to current TypeId instance
bool rili::TypeId::operator== ( TypeId const &  other) const
inline

compare operator

Parameters
otherTypeId object
Returns
true if other was created for the same type, otherwise false

The documentation for this class was generated from the following file: