Skip to content

Commit ff41bc1

Browse files
committed
feat: improve Offset2ID
1 parent e7427bc commit ff41bc1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

include/REL/Offset2ID.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace REL
1616
using const_iterator = typename container_type::const_iterator;
1717
using const_reverse_iterator = typename container_type::const_reverse_iterator;
1818

19-
void load(std::span<IDDB::MAPPING> a_span)
19+
void load_v2()
2020
{
2121
const auto iddb = IDDB::GetSingleton();
2222
const auto id2offset = iddb->get_id2offset<IDDB::MAPPING>();
@@ -27,17 +27,17 @@ namespace REL
2727
});
2828
}
2929

30-
void load(std::span<std::uint32_t> a_span)
30+
void load_v5()
3131
{
3232
const auto iddb = IDDB::GetSingleton();
3333
const auto id2offset = iddb->get_id2offset<std::uint32_t>();
3434
_offset2id.reserve(id2offset.size());
3535

3636
std::uint64_t id{ 0 };
3737
for (auto offset : id2offset) {
38-
value_type map{ id++, offset };
39-
_offset2id.emplace_back(map);
38+
_offset2id.emplace(_offset2id.end(), value_type{ id++, offset });
4039
}
40+
4141
std::sort(std::execution::sequenced_policy{}, _offset2id.begin(), _offset2id.end(), [](auto&& a_lhs, auto&& a_rhs) {
4242
return a_lhs.offset < a_rhs.offset;
4343
});

0 commit comments

Comments
 (0)