object_id.hpp: Add is<T>() and as<T>() template functions to object_id_type
This commit is contained in:
parent
83b4edf870
commit
1fb327f6a0
1 changed files with 13 additions and 0 deletions
|
|
@ -67,6 +67,19 @@ namespace graphene { namespace db {
|
|||
return a.number < b.number;
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
bool is() const
|
||||
{
|
||||
return (number >> 48) == ((T::space_id << 8) | (T::type_id));
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
T as() const
|
||||
{
|
||||
FC_ASSERT( is<T>() );
|
||||
return T( *this );
|
||||
}
|
||||
|
||||
uint64_t number;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue