add get_struct_ptr for speedup

This commit is contained in:
bert hubert 2019-06-24 11:16:03 +02:00
parent e02d654dfe
commit c0cc016f3a
1 changed files with 10 additions and 0 deletions

View File

@ -135,6 +135,16 @@ struct MDBOutVal
return ret;
}
template<class T>
const T* get_struct_ptr() const
{
if(d_mdbval.mv_size != sizeof(T))
throw std::runtime_error("MDB data has wrong length for type");
return reinterpret_cast<const T*>(d_mdbval.mv_data);
}
MDB_val d_mdbval;
};