update readme and fix unused function issue (#821)

This commit is contained in:
water111
2021-09-03 19:19:51 -04:00
committed by GitHub
parent 3d7010b05d
commit a96eb800c4
7 changed files with 108 additions and 39 deletions
+9
View File
@@ -102,6 +102,15 @@ int LabelDB::get_index_by_offset(int seg, int offset) const {
return m_labels_by_offset_into_seg.at(seg).at(offset);
}
std::optional<int> LabelDB::try_get_index_by_offset(int seg, int offset) const {
auto it = m_labels_by_offset_into_seg.at(seg).find(offset);
if (it == m_labels_by_offset_into_seg.at(seg).end()) {
return {};
} else {
return it->second;
}
}
int LabelDB::get_index_by_name(const std::string& name) const {
return m_labels_by_name.at(name);
}