Skip to content

Commit

Permalink
orbis-kernel: const correctness for RcIdMap
Browse files Browse the repository at this point in the history
  • Loading branch information
DHrpcs3 committed Oct 31, 2024
1 parent b012964 commit 61f18f6
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions orbis-kernel/include/orbis/utils/IdMap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class RcIdMap {
return index;
}

T *get(std::size_t index) { return objects[index]; }
T *get(std::size_t index) const { return objects[index]; }

void remove(std::size_t index) {
objects[index]->decRef();
Expand All @@ -66,7 +66,7 @@ class RcIdMap {
public:
static constexpr auto npos = static_cast<IdT>(~static_cast<std::size_t>(0));

shared_mutex mutex;
mutable shared_mutex mutex;

struct end_iterator {};

Expand Down Expand Up @@ -213,7 +213,7 @@ class RcIdMap {
return true;
}

Ref<T> get(IdT id) {
Ref<T> get(IdT id) const {
const auto rawId = static_cast<std::size_t>(id) - MinId;

if (rawId >= MaxId - MinId) {
Expand Down Expand Up @@ -276,8 +276,6 @@ class RcIdMap {
m_fullChunks.clear(chunk);
return true;
}

[[deprecated("use close()")]] bool remove(IdT id) { return close(id); }
};

template <typename T, typename IdT = int, std::size_t MaxId = 4096,
Expand Down

0 comments on commit 61f18f6

Please sign in to comment.