Merge pull request #660 from nathanhourt/patch-2
Add compile-time sanity check to generic_index
This commit is contained in:
commit
d7de6f63e8
1 changed files with 2 additions and 0 deletions
|
|
@ -80,6 +80,8 @@ namespace graphene { namespace chain {
|
||||||
|
|
||||||
virtual const object* find( object_id_type id )const override
|
virtual const object* find( object_id_type id )const override
|
||||||
{
|
{
|
||||||
|
static_assert(std::is_same<typename MultiIndexType::key_type, object_id_type>::value,
|
||||||
|
"First index of MultiIndexType MUST be object_id_type!");
|
||||||
auto itr = _indices.find( id );
|
auto itr = _indices.find( id );
|
||||||
if( itr == _indices.end() ) return nullptr;
|
if( itr == _indices.end() ) return nullptr;
|
||||||
return &*itr;
|
return &*itr;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue