fix object id math

This commit is contained in:
Daniel Larimer 2015-08-27 10:45:44 -04:00
parent df3318efc6
commit b8e16e2e94

View file

@ -54,6 +54,9 @@ namespace graphene { namespace db {
object_id_type& operator++(int) { ++number; return *this; }
object_id_type& operator++() { ++number; return *this; }
friend object_id_type operator+(const object_id a, int delta ) {
return object_id_type( space(), type(), instance() + delta );
}
friend size_t hash_value( object_id_type v ) { return std::hash<uint64_t>()(v.number); }
friend bool operator < ( const object_id_type& a, const object_id_type& b )
@ -83,6 +86,9 @@ namespace graphene { namespace db {
object_id( object_id_type id ):instance(id.instance())
{
}
friend object_id operator+(const object_id a, int delta ) { return object_id( instance+delta ); }
operator object_id_type()const { return object_id_type( SpaceID, TypeID, instance.value ); }
operator uint64_t()const { return object_id_type( *this ).number; }